2. History Of
C is a middle level programming language.which is
developed by Dennis Ritchie while working at AT&T Bell
Labs in USA in between 1969 and 1973.
3. {
First C Program;
}
1#include<stdio.h>
2 int main()
3 {
4 printf("Hello C");
5 return 0;
6 }
4. {
Comments in C Program;
}
Single Line comment
/*…comments…..*/
Multi Line Comments
/*
Comments
*/
9. {
Size of Data type in C;
}
int 2 -32768 to +32767
long 4 -2,147,483,648 to
2,147,483,647
Float 4 1.2E-38 to 3.4E+38
Double 8 2.3E-308 to 1.7E+308
Char 1 -128 to +127
Data Type Name Size(Byte) Range
10. {
Variable Declaration in C;
}
Syntax
Datatype_name variable_name;
or
Datatype_name variable_name = values;
Example
Int a;
Or
Int a = 100;
11. {
Constant Variable Declaration in C;
}
Syntax
Const Datatype_name variable_name = values;
Example
Const float pi = 3.1416;
16. {
Operator in C;
}
C language is rich in built-in operators and provides the
following types of operators −
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Bitwise Operators
5. Assignment Operator
22. {
Condition Operator in C;
}
Syntax:
(condition) ? True_res : false_res;
#include <stdio.h>
int main()
{
int x=1, y ;
y = ( x ==1 ? 2 : 0 ) ;
printf("x value is %dn", x);
printf("y value is %d", y);
}
23. {
Simple Program Using Operator in C;
}
1 #include<stdio.h>
2int main()
3{
4 int a=10,b=5;
5 int add = a+b;
6 int sub = a-b;
7 int mul = a*b;
8 int div = a/b;
9 printf(“Add = %d”,add);
10 printf(“Sub = %d”,sub);
11 printf(“mul = %d”,mul);
12. printf(“div = %d”,div);
13return 0;
14}
25. {
Conditional Execution in C;
}
In the c programming have some decision making Statement.
1. if statement
2. if...else statement
3. nested if statements
4.switch statement
5. nested switch statements
26. {
If Condition in C;
}
Syntax
If(condition)
{
Statement..1;
Statement..2;
Statement..n;
}
42. {
Break Statement in C;
}
The break statement terminates the loop body immediately
and passes control to the next statement after the loop. Break
statement are mainly used with loop and switch statement.
53. {
* Pointer in C;
}
A pointer is a variable whose value is the address of
another variable. Like any variable or constant, you must
declare a pointer before using it to store any variable
address.
54. {
Declaration of Pointer in C;
}
Syntax
data_type *var_name;
Example
int var = 20;
int *ip;
ip = &var;
56. {
File in C;
}
file is a place on your physical disk where information is stored.
Open a File
FILE *name;
name = fopen(“text.txt","a");
fclose(name);
57. {
File in C;
}
Write in a File
FILE *name;
name = fopen(“text.txt",“w");
If(name == NULL)
{
printf(“File Dose Not exist”);
}
else
{
for(i = 0; i < 10;i++){
fprintf (fp, "This is line %dn",i + 1);
}
fclose(name);
}
58. {
File in C;
}
Read in a File
FILE *name;
name = fopen(“text.txt",“w");
Char buff[200];
If(name == NULL)
{
printf(“File Dose Not exist”);
}
else
{
while(fscanf(fp, "%s", buff)!=EOF){
printf("%s ", buff );
}
fclose(name);
}