techpreparation-homepage

Home  Interview Questions  Certifications  Aptitude Questions  Tutorials  Placement Papers  Search  Resume  Soft Skills  Video  Forum  Blog

  C Programming Tutorials
Basics of C:
Facts about C
Why to Use C
C Program File
C Compilers

Program Structure:
Simple C Program
C Program Compilation

Basic DataTypes:
DataTypes
Modifiers
Qualifiers
Arrays

Variable Types:
Local Variable
Global Variable

Storage Classes:
auto storage class
register storage class
static storage class
extern storage class

Using Constants:
Defining Constants
The enum Data Types

Operator Types:
Arithmetic Operators
Logical Operators
Bitwise Operators
Assignment Operators
Misc Operators

Control Statements:
Branching
Looping

Input and Output:
printf() function
scanf() function

Pointing to Data:
Pointers and Arrays
Pointer Arithmetic
Pointer Arithmetic with arrays

Functions:
Using functions
Declaration and Definition

Strings:
Reading and Writing Strings
String Manipulation Function

Structured DataTypes:
Structure
Pointer to Structure

Working with Files:
Files
Basic I/O

Bits:
Bits Manipulation
Bits Field

Pre-Processors:
Pre-Processors Examples
Parameterized Macros
Macro Caveats

Useful Concepts

Built-in Library Functions:
String Manipulation Function
Memory Management Function
Buffer Manipulation
Character Functions
Error Handling Functions

Soft Skills
Communication Skills
Leadership Skills
                              .........More

 

 

  

C Programming Tutorials


Input and Output
Input : In any programming language input means to feed some data into program. This can be given in the form of file or from command line. C programming language provides a set of built-in functions to read given input and feed it to the program as per requirement.

Output : In any programming language output means to display some data on screen, printer or in any file. C programming language provides a set of built-in functions to output required data.

printf() function
This is one of the most frequently used functions in C for output. ( we will discuss what is function in subsequent chapter. ).

Try following program to understand printf() function.

#include <stdio.h>

main()
{
int dec = 5;
char str[] = "abc";
char ch = 's';
float pi = 3.14;

printf("%d %s %f %c\n", dec, str, pi, ch);
}

The output of the above would be:

 5 abc 3.140000 c

Here %d is being used to print an integer, %s is being usedto print a string, %f is being used to print a float and %c is being used to print a character.

scanf() function
This is the function which can be used to to read an input from the command line.

Try following program to understand scanf() function.

#include <stdio.h>

main()
{
int x;
int args;

printf("Enter an integer: ");
if (( args = scanf("%d", &x)) == 0)
{
printf("Error: not an integer\n");
} else {
printf("Read in %d\n", x);
}
}

Here %d is being used to read an integer value and we are passing &x to store the vale read input. Here &indicates the address of variable x.

This program will prompt you to enter a value. Whatever value you will enter at command prompt that will be output at the screen using printf() function. If you enter a non-integer value then it will display an error message.

Enter an integer: 20
Read in 20

NEXT >> Pointing To Data

Have a Question ? post your questions here. It will be answered as soon as possible.

Check C Aptitude Questions for more C Aptitude Interview Questions with Answers

Check C Interview Questions for more C Interview Questions with Answers