Overview of “C” 
By Abhinav and Aayush 1
History Of C Language 
• The origin of C language dates back to 1972. 
• Dennis M. Ritchie is the man who owns the 
credit of creating the C language. 
• Although created in 1972, it was standardized 
in 1989 by ANSI(American National Standard 
Institute). It came to be known as ANSI C. 
• Some of them have even provided an 
integrated development environment, more 
commonly known as IDE. 
By Abhinav and Aayush 2
Structure of a C program 
Documention 
File include section 
Symbolic Constant Definition 
Global Declaration 
Main() 
{ 
Declaration 
Executable Statements 
} 
Function 1 
{ 
Declaration 
Executable Statement 
} 
Function N 
Optional Section used for Decoumention and global 
declarations 
Compulsory Section for all Executable C program 
Optional Section used to write user defined functions 
By Abhinav and Aayush 3
Character set of C 
• Letters(a To z and A To Z) 
• Digits (0 ,1,2,3,4,5,6,7,8,9) 
• White spaces(Blank space, Form feed, 
Horizontal tab, New line, vertical tab) 
• Special Characters( & , ‘ * @  {} [] ^ : $ = ! / > 
# < - () % . + ? “ ; _ |) 
By Abhinav and Aayush 4
#include<stdio.h> (Keyword) 
main() 
{ 
int i_tot_cost, i_qty=12,i_cost=50; 
clrscr(); 
i_tot_cost=i_qty*i_cost; 
Printf(“Cost of %d items is %d”,i_qrt,i_cost); 
return; 
} 
(Constant) 
(Identifier) 
(Operator) 
(String) 
(Special Character) 
By Abhinav and Aayush 5
Keyword 
Auto double int stuct 
Break else long switch 
Case enum register typedef 
Char extern return union 
Const float short unsigned 
Continue for signed void 
Default goto sizeof volatile 
Do if static while 
By Abhinav and Aayush 6
Constant 
Numeric 
Constant 
Character 
Symbolic 
Black 
Slash 
(1) Integer 
(2) Real 
(1) Single Character 
(2) String 
7 
Eg.- 
“n” 
By Abhinav and Aayush
Back Slash Characters 
Back Slash Characters ASCII Value 
0 0 
a 7 
b 8 
t 9 
n 10 
f 12 
* 34 
By Abhinav and Aayush 8
Data Types 
Primitive Non-Primitive 
Int char float 
void pointer 
Array Enum 
Struct 
By Abhinav and Aayush 9
Input and Output Functions 
Formatted Function 
Function Used for 
Scanf Input 
Printf Output 
unformatted Function 
Function Used for 
Getchar() input 
Gets() input 
Getc() input 
Putchar() output 
Putc() output 
Puts() output 
By Abhinav and Aayush 10
Input 
• scanf(“string”,&address_list_of_identifiers); 
• identifier name=getchar(); 
• identifier name=getc(stdin); 
• gets(identifier name); 
By Abhinav and Aayush 11
Output 
Printf(“message string”); 
Putchar(“a”); 
putc(“a”); 
puts(“identifier name”); 
By Abhinav and Aayush 12
Operator 
Arithmetic 
Assignment 
Relation 
Increment/Decrement 
Conditional 
Logical 
Bitwise 
Special 
By Abhinav and Aayush 13
Arithmetic Operators 
+ Addition operator 
- Subtraction operator 
• Multiplication operator 
/ Division operator 
% Module operator 
By Abhinav and Aayush 14
Assignment Operators 
Identifier A0p=constant value; 
Ex- 
Area=(base * height)/2; 
Roll_no=14; 
By Abhinav and Aayush 15
Relational Operators 
== Equal to 
!= Not Equal to 
> Greater than 
< Less than 
>= Greater than Equal to 
<= Less than Equal to 
By Abhinav and Aayush 16
Increment and Decrement Operators 
++identifier or identifier++ 
--identifier or identifier— 
By Abhinav and Aayush 17
Condition 
(condition) ? (true statement) : (false statement) 
Ex-i_ 
minimum=(i_num1<=i_num2)?(i_num1):(i_num2); 
Printf(“the min value of the two is %d”,i_minimum); 
By Abhinav and Aayush 18
Logical Operators 
&& Logical AND 
|| Logical Or 
! Logical NOT 
By Abhinav and Aayush 19
Bitwise Operators 
& Bitwise AND 
| Bitwise OR 
~ Bitwise NOT 
^ Bitwise Exclusive OR 
By Abhinav and Aayush 20
Special Operators 
• Category Symbol 
• Sizeof sizeof() 
• Pointer & , * 
• Member Selection . , -> 
By Abhinav and Aayush 21
If Statement 
if(test condition) 
Action statement; 
If-else Statement 
if(test condition) 
{ 
True action statement; 
} 
else 
{ 
False action statement; 
} 
By Abhinav and Aayush 22
Switch 
Switch(expression) 
{ 
Case v1: 
Action block 1; 
break; 
- 
- 
Case value N : 
Action block N; 
Break; 
Default : 
Action block; 
Break; 
} By Abhinav and Aayush 23
For loop 
For(initiailization; condition;increment) 
{ 
Action block; 
} 
while loop 
While(test condition) 
Action block; 
By Abhinav and Aayush 24
Do while 
Do 
{ 
Action block; 
} 
While(test condition); 
By Abhinav and Aayush 25
Goto 
goto label; 
By Abhinav and Aayush 26
Types of function 
• Function with no parameter and no return 
value 
• Function with no parameter and return value 
• Function with parameter and return value 
• Function with parameter and no return value 
By Abhinav and Aayush 27
Steps of function 
• Function declaration( above main function) 
• Function call(in the main function) 
• Function definition( below main function) 
By Abhinav and Aayush 28
Call by value 
Function call time passing value it is called “call 
by value”. 
C=add(a,b) 
Call by reference 
Function call time passing address it is called 
“call by reference”. 
C=add(&a,&b) 
By Abhinav and Aayush 29
Types of array 
• Single-dimensional array 
• Two-dimensional array 
• Multi-dimensional array 
By Abhinav and Aayush 30
Single-dimensional array 
If an array has only one dimensional, it is call 
Single-dimensional array 
Syntax- 
Type arrayname[size]; 
Ex- 
Int a[5]; 
By Abhinav and Aayush 31
Two-dimensional array 
If an array has only two dimensional, it is call 
two-dimensional array 
Syntax- 
Type arrayname[size] [size] [size]; 
Ex- 
Int [5][5]; 
By Abhinav and Aayush 32
Multi-dimensional array 
If an array has two or more dimensional it is call 
multi-dimensional array 
Syntax- 
Type arrayname[size] [size] [size]; 
Exp- 
Int [5][5][2]; 
By Abhinav and Aayush 33
String 
One or more character are called string. 
Syntax 
Data type string name[size]; 
Ex- 
Char name[10]; 
By Abhinav and Aayush 34
Type of string 
• Strcat()-join two string 
• Strcpy()-one string copy to another 
• Strcmp()-comparison two strings. 
• Strlen()-length 
By Abhinav and Aayush 35
Strcat() 
S1=abc S2=def 
S3=strcat(S1,S2); 
abcdef 
Strcpy() 
S1=abc S2=def 
S3=strcpy(S1,S2); 
def 
By Abhinav and Aayush 36
Strcmp() 
S1=abc S2=xaz 
S3=strcmp(S1,S2) 
a 
Strlen() 
S1=tbs 
n=strlen(S1); 
n=3 
By Abhinav and Aayush 37
Structure 
• Structure is user define data type it is used to 
collection of deffertent data item in single location. 
Syntax- 
Struct structure name 
{ 
Data item 1 
-- 
-- 
} 
By Abhinav and Aayush 38
Union 
Union are same to Structure. One different 
between structure and union. Structure 
member’s memory allocate every member but 
union have only one member’s memory 
allocate. 
By Abhinav and Aayush 39
By Abhinav and Aayush 40
Thank You 
By Abhinav and Aayush 41

Overview of c (2)

  • 1.
    Overview of “C” By Abhinav and Aayush 1
  • 2.
    History Of CLanguage • The origin of C language dates back to 1972. • Dennis M. Ritchie is the man who owns the credit of creating the C language. • Although created in 1972, it was standardized in 1989 by ANSI(American National Standard Institute). It came to be known as ANSI C. • Some of them have even provided an integrated development environment, more commonly known as IDE. By Abhinav and Aayush 2
  • 3.
    Structure of aC program Documention File include section Symbolic Constant Definition Global Declaration Main() { Declaration Executable Statements } Function 1 { Declaration Executable Statement } Function N Optional Section used for Decoumention and global declarations Compulsory Section for all Executable C program Optional Section used to write user defined functions By Abhinav and Aayush 3
  • 4.
    Character set ofC • Letters(a To z and A To Z) • Digits (0 ,1,2,3,4,5,6,7,8,9) • White spaces(Blank space, Form feed, Horizontal tab, New line, vertical tab) • Special Characters( & , ‘ * @ {} [] ^ : $ = ! / > # < - () % . + ? “ ; _ |) By Abhinav and Aayush 4
  • 5.
    #include<stdio.h> (Keyword) main() { int i_tot_cost, i_qty=12,i_cost=50; clrscr(); i_tot_cost=i_qty*i_cost; Printf(“Cost of %d items is %d”,i_qrt,i_cost); return; } (Constant) (Identifier) (Operator) (String) (Special Character) By Abhinav and Aayush 5
  • 6.
    Keyword Auto doubleint stuct Break else long switch Case enum register typedef Char extern return union Const float short unsigned Continue for signed void Default goto sizeof volatile Do if static while By Abhinav and Aayush 6
  • 7.
    Constant Numeric Constant Character Symbolic Black Slash (1) Integer (2) Real (1) Single Character (2) String 7 Eg.- “n” By Abhinav and Aayush
  • 8.
    Back Slash Characters Back Slash Characters ASCII Value 0 0 a 7 b 8 t 9 n 10 f 12 * 34 By Abhinav and Aayush 8
  • 9.
    Data Types PrimitiveNon-Primitive Int char float void pointer Array Enum Struct By Abhinav and Aayush 9
  • 10.
    Input and OutputFunctions Formatted Function Function Used for Scanf Input Printf Output unformatted Function Function Used for Getchar() input Gets() input Getc() input Putchar() output Putc() output Puts() output By Abhinav and Aayush 10
  • 11.
    Input • scanf(“string”,&address_list_of_identifiers); • identifier name=getchar(); • identifier name=getc(stdin); • gets(identifier name); By Abhinav and Aayush 11
  • 12.
    Output Printf(“message string”); Putchar(“a”); putc(“a”); puts(“identifier name”); By Abhinav and Aayush 12
  • 13.
    Operator Arithmetic Assignment Relation Increment/Decrement Conditional Logical Bitwise Special By Abhinav and Aayush 13
  • 14.
    Arithmetic Operators +Addition operator - Subtraction operator • Multiplication operator / Division operator % Module operator By Abhinav and Aayush 14
  • 15.
    Assignment Operators IdentifierA0p=constant value; Ex- Area=(base * height)/2; Roll_no=14; By Abhinav and Aayush 15
  • 16.
    Relational Operators ==Equal to != Not Equal to > Greater than < Less than >= Greater than Equal to <= Less than Equal to By Abhinav and Aayush 16
  • 17.
    Increment and DecrementOperators ++identifier or identifier++ --identifier or identifier— By Abhinav and Aayush 17
  • 18.
    Condition (condition) ?(true statement) : (false statement) Ex-i_ minimum=(i_num1<=i_num2)?(i_num1):(i_num2); Printf(“the min value of the two is %d”,i_minimum); By Abhinav and Aayush 18
  • 19.
    Logical Operators &&Logical AND || Logical Or ! Logical NOT By Abhinav and Aayush 19
  • 20.
    Bitwise Operators &Bitwise AND | Bitwise OR ~ Bitwise NOT ^ Bitwise Exclusive OR By Abhinav and Aayush 20
  • 21.
    Special Operators •Category Symbol • Sizeof sizeof() • Pointer & , * • Member Selection . , -> By Abhinav and Aayush 21
  • 22.
    If Statement if(testcondition) Action statement; If-else Statement if(test condition) { True action statement; } else { False action statement; } By Abhinav and Aayush 22
  • 23.
    Switch Switch(expression) { Case v1: Action block 1; break; - - Case value N : Action block N; Break; Default : Action block; Break; } By Abhinav and Aayush 23
  • 24.
    For loop For(initiailization;condition;increment) { Action block; } while loop While(test condition) Action block; By Abhinav and Aayush 24
  • 25.
    Do while Do { Action block; } While(test condition); By Abhinav and Aayush 25
  • 26.
    Goto goto label; By Abhinav and Aayush 26
  • 27.
    Types of function • Function with no parameter and no return value • Function with no parameter and return value • Function with parameter and return value • Function with parameter and no return value By Abhinav and Aayush 27
  • 28.
    Steps of function • Function declaration( above main function) • Function call(in the main function) • Function definition( below main function) By Abhinav and Aayush 28
  • 29.
    Call by value Function call time passing value it is called “call by value”. C=add(a,b) Call by reference Function call time passing address it is called “call by reference”. C=add(&a,&b) By Abhinav and Aayush 29
  • 30.
    Types of array • Single-dimensional array • Two-dimensional array • Multi-dimensional array By Abhinav and Aayush 30
  • 31.
    Single-dimensional array Ifan array has only one dimensional, it is call Single-dimensional array Syntax- Type arrayname[size]; Ex- Int a[5]; By Abhinav and Aayush 31
  • 32.
    Two-dimensional array Ifan array has only two dimensional, it is call two-dimensional array Syntax- Type arrayname[size] [size] [size]; Ex- Int [5][5]; By Abhinav and Aayush 32
  • 33.
    Multi-dimensional array Ifan array has two or more dimensional it is call multi-dimensional array Syntax- Type arrayname[size] [size] [size]; Exp- Int [5][5][2]; By Abhinav and Aayush 33
  • 34.
    String One ormore character are called string. Syntax Data type string name[size]; Ex- Char name[10]; By Abhinav and Aayush 34
  • 35.
    Type of string • Strcat()-join two string • Strcpy()-one string copy to another • Strcmp()-comparison two strings. • Strlen()-length By Abhinav and Aayush 35
  • 36.
    Strcat() S1=abc S2=def S3=strcat(S1,S2); abcdef Strcpy() S1=abc S2=def S3=strcpy(S1,S2); def By Abhinav and Aayush 36
  • 37.
    Strcmp() S1=abc S2=xaz S3=strcmp(S1,S2) a Strlen() S1=tbs n=strlen(S1); n=3 By Abhinav and Aayush 37
  • 38.
    Structure • Structureis user define data type it is used to collection of deffertent data item in single location. Syntax- Struct structure name { Data item 1 -- -- } By Abhinav and Aayush 38
  • 39.
    Union Union aresame to Structure. One different between structure and union. Structure member’s memory allocate every member but union have only one member’s memory allocate. By Abhinav and Aayush 39
  • 40.
    By Abhinav andAayush 40
  • 41.
    Thank You ByAbhinav and Aayush 41