C Language
C Language
First Programming Language is Cobal in Develop 1950. Then it Language is improved and convert BCPL
Language. BCPL Stand for Basic Combined Programming Language, It is Not support Unix and Linux Operating
system. Then it Language is Improved and Convert B Language. B language is Not Support all Data Type, So It is
Type less language… It is Develop by Ken Thompson In 1970. Then It is improved and Convert C Language.
C Language
C is a High-Level Language; High level Language is that language which computer can understand Very Easily. C
is Mother level Language. C is System Programming language. C is Structured Programming Language. C
Language is Developed by Dennis Ritchie in 1972 At & TBell (American Telephonic and Telegraph) Lab In USA.
Feature Of C Language
There are Some Features of C language.
1. Simple
2. Portable
3. System Programming
4. Structured
5. Ritch Library…. etc.…
Structure of C Program
If We Make C Program then some steps are Used: -
Documentation Block (Optional Block)
Header Section (Essential Block)
Global Section (Optional Block)
Main Section (Essential Block)
I—Input
P-- Processing
O-- Output
UDF (User Define Function)
Compiler
Compiler is an Application That is Convert Source code into machine code.
Source code Machine code
.C/.Cpp 0011
Keyword
Keyword is a Reserve word, Reserve word means It is Predefine Into Compiler.
In a C Language 32 Keywords are Available.
Ex: - if, if-else, else-if, for, while, do-while, etc.
Header File
Header File is also known as Library files. It is predefine method (function). Some
header file like this.
Ex: - stdio.h, conio.h, math.h, graphics.h, dos.h, stdlib.h, etc.
Data Type
This type of data is called Data_Type.
There are Two type of Data_Type.
1. Primitive Data_Type (int, float, char, double etc.)
2. Non Primitive Data_Type (array, structure, union, pointer etc.)
1.scanf() => scanf is a input method that is 2.printf => printf is a output method that is write
used to read the integer, float, char, double etc. the character, integer, float, char, double from
type value from numeric keyword. keyword..
=> scanf is input method that is take user => printf is show the Output of the console window.
input..
Syntax with Example: -
Syntax: - Int a,b,c;
scanf (“format-specifier”, &variable list); printf (“Enter any two number”);
Ex: - c=a+b;
Int a; printf (“string value=%format-specifier”, where
scanf(“%d”,a); value is store);
printf(“sum=%d”,c);
Note: - When Data type is:-
Int Format-specifier%d
float %f
char %c
double %If
long %Id
string %s
etc.
VARIABLE
OPERATOR
Statement
Statement has the Block of code that execute Hole Body
There are Three Type of Statement.
1 Conditional statement
2 looping statement
3 jump Control Statement
Conditional Statement-
Conditional statement is block of code, it used to check the
condition
This is Two Types of Conditional Statement
a) If Statement
b) Switch Statement
Syntax:- Ex:-
If(condition) If(a==1)
{ {
} }
2. if else :- if-else is a keyword. If given condition is true then If block of code will be
execute, Otherwise else block of code will be execute...
Syntax: - Ex: -
If (condition) //true block If(year%4=0)
{ {
//block of code; //block of code;
} }
//False block Else
{ {
//block of code; //block of code;
} }
Else If
Else if is known as ladder if. By using ladder if we can check multiple condition at a
time but only one condition will be executed.
Syntax: -
If(condition1)
{
//block of code;
}
Else if(condition2)
{
//Block of code;
}
.
.
Else //false block
{
//block of code;
}
Nested If
When any If Condition is Available into another If, Then This process is known as Nested If..
Syntax: -
}
else //False of second condition
{
//block of code;
}
Syntax: - 4.
Switch (Variable)
{
case 1;
{
//block of code;
break;
}
Case 2;
{
//block of code;
break;
}
..
..
Default: //it is optional block
{
//block of code;
}
}
Looping Statement
If you want to execute block of code again and again based on condition, Then this Process
is known as Looping.
Looping
For Loop: - for is a keyword, In a for Initialization, Condition , Updation into single line
terminated by Semicolon.
Ex: -
Syntax for Loop: -
//wap in c to print 1 to 10 number
For(initialization;condition;updation)
Int i;
{
For(i=1;i<=10;i++)
//body of loop
}
//body of loop;
}
Condition(range)
Updation(increment/Decrement)
While Loop
While is a Keyword. While loop checked the condition as the Entry Point, So It is also known
as the Entry control loop.
Syntax: - Do-while loop:- Do-while Loop is a Keyword
//updation;
While(condition);
Array
Array is the collection of similar data type, similar data type means the same type of data or
value.
Syntax: - Note: -
Data type array The Initialization of an array is start
name[size]; Size: - Length of an array
from 0 to n-1.
Ex: - Where n is length of an array
Int list (10);
Note: - Without using an array we can store single variable in to
single data type but by using an array we can store Multiple
Data into single variable.
Types of Array
1. One Dimensional array(1D)
2. Two-Dimensional array(2D)
3. Multi-Dimensional Array
One Dimensional array=>
In a one-Dimensional Array Only single subscript[] are
used that array is called One Dimensional Array.
Syntax: -
Data type arrname[size];
Ex: -
Int a [10]
Two-Dimensional Array: -
In a Two-Dimensional Array Two subscript[] are used that array is
called Two-Dimensional Array.
In a Two-Dimensional Array, Row and Column are used.
Syntax: -
Data type arrname[row][column];
Ex: -
Int list [2][2];
//function
//
H.W.