SlideShare a Scribd company logo
Respected Principal sir, HOD
sir and our all teachers from
our Branch, we Heartily
welcome to watch our
presentation on “Summer
internship training”.
WELCOME
CANDIDATE DECLARATION
We are the student of 2nd year (CSE) declare that we own full responsible
for the information result etc. provided in project title “C-Programming”,
Submitted to DEPARTMENT OF COMPUTER SCIENCE GOVT.
POLYTECNIC COLLEGE (KOTA) RAJASTHAN for THE DIPLOMA IN
COMPUTER SCIENCE. In all respect we have taken care of the intellectual
Proprietary right & copyright. Our project in-charge and institute should not
Be held responsible for full or partial violation of copyright if found any
stage of my diploma.
DATE:
23/09/2023
Place-KOTA
Submitted by :
PRACTICAL TRAINING REPORT PPT
MCM COMPUTER EDUCATION INSTITUTE
ON
( C- language )
Taken On
SUBMITTED IN PARTIAL FULFILLMENTN OF THE REQUIREMENT FOR THE
AWARD OF THE DIPLOMA OF ENGINEERING
ANAND KUAMR VERMA & SAGAR KUMAR
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
Session : 2023 - 2024
GOVERNMENT POLYTECHNIC COLLEGE,
D.C.M. ROAD, KOTA-324007
1. Topic Name Slide number
2. Introduction of C : 5 to 6
3. Basic structure of c-language : 7
4. Role of main() function : 8 to 9
5. C-Tokens & variables : 10
6. Constant & keyword : 11
7. Types of keyword in “c”- language : 12
8. Data types in “c”-language : 13
9. Types of operators in “c”-language : 14
10. Branching in “c”-language : 15 to 20
11. Decision making and looping : 21 to 23
12. Array : 24 to 25
13. String : 26 to 27
14. Function : 28
15. Recursion : 29
Table of Contents
Introduction:-
‘C’ is a Structure Programming Language and mostly used for software
developing purpose. It was an offspring of the BCPL ‘Basic Combined
Programming Language’, called B, developed in 1970’s. ‘B’ Language was
modified by Dennis Ritchie and was implemented at Bell Laboratories in 1972.
the new language was named ‘C’.
It was developed along with the UNIX operating system, but it is running
under a number of Operating Systems including MS-DOS.
Introduction of The “C’ Language
Importance of ‘C’:-
It is robust language whose rich set of built-in functions and operators can be
used to write any complex program. The ‘C’ compiler combines the
capabilities of an assembly language with the features of a high-level language.
It is well suited for writing both system software and business packages.
Programs written in ‘C’ are efficient an fast. This is due to its variety of data
types and powerful operators. It is many times faster than BASIC.
There are 32 types of Keywords and its strength lines in its built-in functions.
‘C’ is highly portable. This means that ‘C’ programs written for one computer
can be run on another with little or no modifications.
 Documentation Section
 Link Section
 Definition Section
 Global Declaration Section
 Main() function section
 {
 Declaration part
 Executable part
 }
 Subprograme Section
 Function-1
 Function-2 {used defined function}
 Function-n {An over of drive a “C” Language}
Basic Structure of “C” Language
‘C’ language is well suited for structured programming language, thus requiring the user to
think of a problem in terms of function modules or blocks. A proper collection of these
modules would make a complete program. This modular structure makes program debugging,
testing and maintenance easier.
Another important feature of ‘C’ is its ability to extend itself. A ‘C’ program is basically a
collection of functions that are supported by the ‘C’ library.
Example of B.S
//sexplain the simple program//
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
printf(“enter the a value:”);
scanf(“%d”,&a);
printf(“n value of a=%d”,a);
}
Main():-
The Main() is a special function, used by the ‘C’ system to tell the computer
where the program starts. Every program must have exactly one main
function. If we use more than one main function, the compiler cannot tell
which one marks the beginning of the program.
The empty pair of parentheses immediately following main indicates that the
function main has no arguments (or parameters).
The opening brace ‘{‘ in the second line marks the beginning of the function
main and the closing brace ‘}’ in the last line indicates the end of the function.
The closing brace also marks the end of the program. All the statements
between these two braces form the function body. It contains a set of
instructions to perform the given task.
Role of Main() Function
Every ‘C’ program must have one main() section. This section contains two
parts, declaration part and executable part. The declaration part declares all
the variables used in the executable part. There is at least one statement in the
executable part. These two parts must appear between the opening and the
closing braces. The program execution begins at the opening brace and ends at
the closing brace. The closing brace of the main function section is the logical
end of the program. All statements in the declaration and executable parts end
with a semicolon.
main() function name
{ start of program
-------- program statements
--------
} end of program
C-TOKENS
• Keywords : int, float, while
• Identifiers : value, amount
• Constant : -15.5 , 100
• Strings : “abc”, “ABC”, “x+y”, ”5”, “d”
• Special Symbols : [ ] , { }
• Operators : + , - , * , / , %
Variable
“Variables are data name, which is used to store any kind of value, constant or expression.
Or
Variables are data names, which value change during the execution of ‘C’ program”
Type of Variable :-
1) Integer Variable : x=169
2) Float Variable : x=169.79
3) Character Variable : x=‘k’/”ram”
4) Long integer Variable : {-32768 to 32767}
CONSTANT
“Constants are fixed values, which does not change during the execution of ‘C’
program”
Type of Constant :-
1) Integer Constant : x=169
2) Float/ Real Constant : x=169.79
3) Character Constant : x=‘k’
4) String Constant : x=“ram”
5) Back Slash Character Constant:: ‘n’, ‘t’, ‘v’ etc.
KEYWORD
 Keywords are those words whose meaning is already defined know to
the compiler.
 It is also know as Reserved words.
 Keywords are not used as variable name.
Keywords are not used as constant name.
There are 32 Key-words in “C” Language
Types of Keywords In “C” Language
1.auto
2.break
3.case
4.char
5.const
6.continue
7.default
8.do
9.double
10.else
11.enum
12.extern
13.float
14.for
15.goto
16.if
17. int
18.long
19.register
20.return
21.short
22.signed
23.sizeof
24.static
25.struct
26.switch
27.typedof
28.union
29.unsigned
30.void
31.volatile
32.while
Data Types in “C” Language
“C language is rich in its data types. There are four classes of data types:”
1. Primary or Fundamental data types:-
All C compilers support four fundamental data types, namely
integer (int), character (char), floating point (float), and double-precision
floating point (double).
2. User-defined data types:-
typedef, enum are the user-defined data type.
3. Derived data types:-
Arrays, functions, structures and pointers are derived data types.
4. Empty data set:-
void main()
Types of Operators In “C” Language
“Operators are used in programs to manipulate data and Variables”
There are 8 types of operators in ‘C’ Language-
1) Arithmetic Operators
2) Relational Operators
3) Logical Operators
4) Assignment Operators
5) Increment and decrement Operators
6) Bitwise Operators
7) Conditional Operators
8) Special Operators
Branching in “C” Language
“C language possesses such decision making capabilities and supports for the
following statements known as Control or Decision Making Statements.”
A. If statement
B. Switch Statement
C. Conditional Operator Statement
D. GOTO Statement
A. If Statement:-
1. Simple If statement
2. If ….. Else Statement
3. Nested If … else Statement
4. Else If Ladder Statement
A-1. Simple If A-2. If….else
Syntax:
If (Test Condition)
{
Statement Block;
}
Statement-x;
Next Statement;
Example:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf(“n Enter A and B Value:”);
scanf(“%d,%d”, &a, &b);
if (a>b)
{
printf(“n A is Greater=%d”,a);
}
}
Syntax:
If (Test Condition)
{
True Block Statement;
}
Else
{
False Block Statement;
}
Statement-x;
Next Statement;
E x a m p l e :
# i n c l u d e < s t d i o . h >
# i n c l u d e < c o n i o . h >
v o i d m a i n ( )
{
i n t a , b ;
p r i n t f ( “  n E n t e r A a n d B
Va l u e : ” ) ;
s c a n f ( “ % d , % d ” , & a , & b ) ;
I f ( a > b )
{
p r i n t f ( “  n A i s G r e a t e r = % d ” , a ) ;
}
e l s e
{
p r i n t f ( “  n B i s G r e a t e r = % d ” , b ) ;
} }
A-3. Nested If …. Else
Syntax:
If (Test Condition-
1)
{
If (Test Condition-
2)
{
Statement Block-
1;
}
Else
{
Statement Block-
2;
}}
Else
{
Statement Block-
3;
}
Statement-x;
Next Statement;
Example:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
printf(“n Enter A, B and C
Value:”);
scanf(“%d,%d,%d”, &a, &b, &c);
if ((a>b)&& (a>c))
{
if (b>c)
{
printf(“n A is Greater=%d”,a);
}
else
{
printf(“n B is Greater=%d”,b);
}}
else
{
printf(“n C is Greater=%d”,c);
}}
A-4. Else if Ladder
Syntax:
If (Test Condition-1)
Statemetn-1;
Else If (Test Condition-2)
Statement-2;
Else If (Test Condition-3)
Statement-3;
……………………
Else if (Test Condition-n)
Statement-n;
Else
Default Statement;
Statement-x;
Next Statement;
Example:
#include<stdio.h>
#include<conio.h>
void main()
{
int code;
printf(“n 1. Hi n 2. Hello
n 3. How are you?”);
printf(“n Enter your
Choice :”);
scanf(“%d”, &code);
if (code==1)
printf(“n Hi”);
else if (code==2)
printf(“n Hello”);
else if (code==3)
printf(“n How are
you?”);
else
printf(“n All the Best”);
}
B. Switch Statement
Syntax:
Switch (Test expression)
{
Case value-1:
Block-1;
Break;
Case value-2:
Block-2;
Break;
…………………
Default:
Default block;
Break;
}
Statement-x;
Next Statement;
Example:
#include<stdio.h>
#include<conio.h>
void main()
{
int code;
printf(“n 1. Hi n 2. Hello n 3. How are you?”);
printf(“n Enter your Choice :”);
scanf(“%d”, &code);
switch(code)
{
case 1:
printf(“n Hi”);
break;
case 2:
printf(“n Hello”);
break;
case 3:
printf(“n How are you?”);
break;
default:
printf(“n All the Best”);
break;
}}
C. Conditional Operator Statement
Syntax:
Exp1 ? Exp-2 : Exp-3;
Example:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf(“n Enter A and B Value:”);
scanf(“%d,%d”, &a, &b);
(a>b) ? printf(“n A is Greater”) :
printf(“n B is Greater”);
}
“It is also known as Ternary Operator. It has three operands”
D. GOTO Statement
Syntax-1:
Forward Jump
Goto Label;
…………..
…………..
…………..
Label:
Statement;
Example:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,x;
b:
printf(“n Enter A Value:”);
scanf(“%d”, &a);
if(a<0)
{
printf(“n Entire value id either Zero or Negative !! Please try
again…”);
goto b;
}
else
{
printf(“n Good Input:”);
x=a*a;
printf(“n Result is =%d”,x);
}}
Syntax-2:
Backward Jump
Label:
Statement;
…………..
…………..
…………..
Goto Label;
DECISION MAKING
AND
LOOPING
Types of loop in “C” Language
Three types of loop in “C” Language.
“A sequence of Statements are executed until some conditions for
termination of the loop are satisfied”
1. While Loop – Entry Controlled Loop.
2. Do Loop - Exit Controlled Loop.
3. For Loop - Entry Controlled Loop.
While loop:-
Syntax:-
While (Test Condition)
{
Body of the Loop;
}
Example:-
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0;
while(i<=10)
{
i=i+1;
printf(“n Result is=%d”,i);
}}
Do loop:-
syntax:-
Do
{
Body of the Loop;
}
while (Test Condition);
}
Example:
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0;
do
{
i=i+1;
printf(“n Result is=%d”,i);
}
while(i<=10);
}
For loop:-
Syntax:-
For (Initialization;
Test Condition;
Increment/Decremen
t)
{
Body of the Loop;
}
Example:-
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for (i=1; i<=10; i++)
{
printf(“n Result is=
%d”,i);
}
}
 An Array is defined as collection of related items and all
the items are as similar data types.
 Array are the collection of finite number of similar type
data element.
 Array handle a large amount of data in terms of reading,
processing and printing.
Array
Types of array in “C” Language
One Dimensional
Array.
Two Dimensional
Array.
Multi Dimensional
Array.
Three
types of
array in
“C”
Language.
Array examples:-
1. One Dimensional Array
Example:
#include<stdio.h>
void main()
{
int i, a[5];
printf(“n Enter 5 elements :”);
for (i=0; i<5; i++)
{
scanf(“%d”,&a[i]);
}
printf(“n Output of array
elements :”);
for (i=0; i<5; i++)
{
printf(“n %d”,a[i]);
}}
2 . Tw o D i m e n s i o n a l
A r r a y
E x a m p l e :
#include<stdio.h>
void main()
{
int i,j, a[3][3];
printf(“n Enter 3 x 3 elements :”);
for (i=0; i<3; i++)
{
for (j=0; j<3; j++)
{
scanf(“%d”,&a[i][j]);
}}
printf(“n Output of array
elements :”);
for (i=0; i<3; i++)
{
printf(“n”);
for(j=0;j<3;j++)
{
printf(“t %d”,a[i][j]);
}}}
3 . M u l t i
D i m e n s i o n a l A r r a y
Example:
#include<stdio.h>
void main()
{
int i,j,k a[2][3][2];
printf(“n Enter 2 x 3 x 2
elements :”);
for (i=0; i<2; i++)
{
for (j=0; j<3; j++)
{
for (k=0; k<2; k++)
{
scanf(“%d”,&a[i][j][k]);
}}
printf(“n Output of array elements
:”);
for (i=0; i<2; i++)
{
for(j=0;j<3;j++)
{
for (k=0; k<2; k++)
{
printf(“n %d”,a[i][j][k]);
}}}
STRING
“In C language, Array of Characters are called “String”. Any string is the sequential
collection of Characters, which used any single data item. String size denotes the
maximum number of characters can hold. String value will terminate with an
additional null ‘0’ terminator. Hence, at the time of string declaration, one extra
element space will define for the null character.
Syntax: <data type> <Array Name> [size];
Example
Char n[10];
Character
string :-
‘w’ ‘e’ ‘l’ ‘l’ ‘ ‘ ‘d’ ‘o’ ‘n’ ‘e’ ‘0’
N[0] N[1] N[2] N[3] N[4] N[5] N[6] N[7] N[8] N[9]
Example of string :
#include<stdio.h>
void main()
{
char x[50];
printf(“n enter any string”);
gets(x);
puts(x);
}
Category of Functions:-
1. Function with No Argument and No Return Value
2. Function with No Argument and Return Value
3. Function with Argument and No Return Value
4. Function with Argument and Return Value
Function
Function Parameter Passing:-
Syntax:
Function(a1,a2, a3 .... an)
{
----------
----------
}
Function(f,f2,f3, …. Fn)
{
----------
----------
}
Example:
#include<stdio.h>
void main()
{
int ram(int,int),a,b;
printf(“n Enter A and B value :”);
scanf(“%d,%d”,&a,&b);
printf(“n Result is=%d”,ram(a,b);
}
int ram(int x, int y)
{
int z;
z=x+y;
return (z);
}
RECURSION
Definition:
When a function calls a copy of itself
then the process is known as Recursion.
Or
When a function calls itself then this
technique is known as Recursion
E x a m p l e :
# i n c l u d e < s t d i o . h >
v o i d m a i n ( )
{
i n t n , f a c t ( i n t ) ;
p r i n t f ( “  n E n t e r a n y N u m b e r : ” ) ;
s c a n f ( “ % d ” , & n ) ;
p r i n t f ( “  n F a c t o r i a l v a l u e i s =
% d ” , f a c t ( n ) ) ;
}
i n t f a c t ( i n t n )
{
i f ( n = = 0 )
r e t u r n ( 1 ) ;
e l s e
r e t u r n ( n * f a c t ( n - 1 ) ) ;
}
Thank you…

More Related Content

PPTX
What is c
Nitesh Saitwal
 
PPTX
C introduction by thooyavan
Thooyavan Venkatachalam
 
DOC
1. introduction to computer
Shankar Gangaju
 
PPTX
C programming language:- Introduction to C Programming - Overview and Importa...
SebastianFrancis13
 
PDF
C programing Tutorial
Mahira Banu
 
PPTX
Programming in C
Nishant Munjal
 
PPT
The smartpath information systems c pro
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
 
What is c
Nitesh Saitwal
 
C introduction by thooyavan
Thooyavan Venkatachalam
 
1. introduction to computer
Shankar Gangaju
 
C programming language:- Introduction to C Programming - Overview and Importa...
SebastianFrancis13
 
C programing Tutorial
Mahira Banu
 
Programming in C
Nishant Munjal
 
The smartpath information systems c pro
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
 

Similar to C Language ppt create by Anand & Sager.pptx (20)

PPTX
C Programming - Basics of c -history of c
DHIVYAB17
 
PPTX
Overview of C Mrs Sowmya Jyothi
Sowmya Jyothi
 
PPTX
Introduction to c programming
Alpana Gupta
 
PDF
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Rohit Singh
 
PPTX
C language (1).pptxC language (1C language (1).pptx).pptx
RutviBaraiya
 
PDF
Basics of C Prog Lang.pdf
KalighatOkira
 
PPTX
PROGRAMMING IN C - SARASWATHI RAMALINGAM
SaraswathiRamalingam
 
PPSX
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
PDF
C programming course material
Ranjitha Murthy
 
PPTX
C Language (All Concept)
sachindane
 
DOCX
Report on c and c++
oggyrao
 
PPTX
C programming tutorial for Beginner
sophoeutsen2
 
PDF
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
Batra Centre
 
PPTX
unit2.pptx
sscprep9
 
PPTX
C PROGRAMMING LANGUAGE.pptx
AnshSrivastava48
 
PPTX
C programming language tutorial
Dr. SURBHI SAROHA
 
DOCX
Complete c programming presentation
nadim akber
 
DOCX
Let's us c language (sabeel Bugti)
Unviersity of balochistan quetta
 
PPTX
Introduction to C Unit 1
Dr. SURBHI SAROHA
 
PPTX
4 Introduction to C.pptxSSSSSSSSSSSSSSSS
EG20910848921ISAACDU
 
C Programming - Basics of c -history of c
DHIVYAB17
 
Overview of C Mrs Sowmya Jyothi
Sowmya Jyothi
 
Introduction to c programming
Alpana Gupta
 
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Rohit Singh
 
C language (1).pptxC language (1C language (1).pptx).pptx
RutviBaraiya
 
Basics of C Prog Lang.pdf
KalighatOkira
 
PROGRAMMING IN C - SARASWATHI RAMALINGAM
SaraswathiRamalingam
 
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
C programming course material
Ranjitha Murthy
 
C Language (All Concept)
sachindane
 
Report on c and c++
oggyrao
 
C programming tutorial for Beginner
sophoeutsen2
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
Batra Centre
 
unit2.pptx
sscprep9
 
C PROGRAMMING LANGUAGE.pptx
AnshSrivastava48
 
C programming language tutorial
Dr. SURBHI SAROHA
 
Complete c programming presentation
nadim akber
 
Let's us c language (sabeel Bugti)
Unviersity of balochistan quetta
 
Introduction to C Unit 1
Dr. SURBHI SAROHA
 
4 Introduction to C.pptxSSSSSSSSSSSSSSSS
EG20910848921ISAACDU
 
Ad

Recently uploaded (20)

PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
PDF
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
PPTX
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PDF
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
PPT
Ppt for engineering students application on field effect
lakshmi.ec
 
PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PPTX
Civil Engineering Practices_BY Sh.JP Mishra 23.09.pptx
bineetmishra1990
 
PDF
Natural_Language_processing_Unit_I_notes.pdf
sanguleumeshit
 
PPTX
easa module 3 funtamental electronics.pptx
tryanothert7
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
Zero carbon Building Design Guidelines V4
BassemOsman1
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
Zero Carbon Building Performance standard
BassemOsman1
 
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
Ppt for engineering students application on field effect
lakshmi.ec
 
Introduction to Data Science: data science process
ShivarkarSandip
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
Civil Engineering Practices_BY Sh.JP Mishra 23.09.pptx
bineetmishra1990
 
Natural_Language_processing_Unit_I_notes.pdf
sanguleumeshit
 
easa module 3 funtamental electronics.pptx
tryanothert7
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
Zero carbon Building Design Guidelines V4
BassemOsman1
 
Information Retrieval and Extraction - Module 7
premSankar19
 
Ad

C Language ppt create by Anand & Sager.pptx

  • 1. Respected Principal sir, HOD sir and our all teachers from our Branch, we Heartily welcome to watch our presentation on “Summer internship training”. WELCOME
  • 2. CANDIDATE DECLARATION We are the student of 2nd year (CSE) declare that we own full responsible for the information result etc. provided in project title “C-Programming”, Submitted to DEPARTMENT OF COMPUTER SCIENCE GOVT. POLYTECNIC COLLEGE (KOTA) RAJASTHAN for THE DIPLOMA IN COMPUTER SCIENCE. In all respect we have taken care of the intellectual Proprietary right & copyright. Our project in-charge and institute should not Be held responsible for full or partial violation of copyright if found any stage of my diploma. DATE: 23/09/2023 Place-KOTA
  • 3. Submitted by : PRACTICAL TRAINING REPORT PPT MCM COMPUTER EDUCATION INSTITUTE ON ( C- language ) Taken On SUBMITTED IN PARTIAL FULFILLMENTN OF THE REQUIREMENT FOR THE AWARD OF THE DIPLOMA OF ENGINEERING ANAND KUAMR VERMA & SAGAR KUMAR DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Session : 2023 - 2024 GOVERNMENT POLYTECHNIC COLLEGE, D.C.M. ROAD, KOTA-324007
  • 4. 1. Topic Name Slide number 2. Introduction of C : 5 to 6 3. Basic structure of c-language : 7 4. Role of main() function : 8 to 9 5. C-Tokens & variables : 10 6. Constant & keyword : 11 7. Types of keyword in “c”- language : 12 8. Data types in “c”-language : 13 9. Types of operators in “c”-language : 14 10. Branching in “c”-language : 15 to 20 11. Decision making and looping : 21 to 23 12. Array : 24 to 25 13. String : 26 to 27 14. Function : 28 15. Recursion : 29 Table of Contents
  • 5. Introduction:- ‘C’ is a Structure Programming Language and mostly used for software developing purpose. It was an offspring of the BCPL ‘Basic Combined Programming Language’, called B, developed in 1970’s. ‘B’ Language was modified by Dennis Ritchie and was implemented at Bell Laboratories in 1972. the new language was named ‘C’. It was developed along with the UNIX operating system, but it is running under a number of Operating Systems including MS-DOS. Introduction of The “C’ Language
  • 6. Importance of ‘C’:- It is robust language whose rich set of built-in functions and operators can be used to write any complex program. The ‘C’ compiler combines the capabilities of an assembly language with the features of a high-level language. It is well suited for writing both system software and business packages. Programs written in ‘C’ are efficient an fast. This is due to its variety of data types and powerful operators. It is many times faster than BASIC. There are 32 types of Keywords and its strength lines in its built-in functions. ‘C’ is highly portable. This means that ‘C’ programs written for one computer can be run on another with little or no modifications.
  • 7.  Documentation Section  Link Section  Definition Section  Global Declaration Section  Main() function section  {  Declaration part  Executable part  }  Subprograme Section  Function-1  Function-2 {used defined function}  Function-n {An over of drive a “C” Language} Basic Structure of “C” Language ‘C’ language is well suited for structured programming language, thus requiring the user to think of a problem in terms of function modules or blocks. A proper collection of these modules would make a complete program. This modular structure makes program debugging, testing and maintenance easier. Another important feature of ‘C’ is its ability to extend itself. A ‘C’ program is basically a collection of functions that are supported by the ‘C’ library. Example of B.S //sexplain the simple program// #include<stdio.h> #include<conio.h> void main() { int a; printf(“enter the a value:”); scanf(“%d”,&a); printf(“n value of a=%d”,a); }
  • 8. Main():- The Main() is a special function, used by the ‘C’ system to tell the computer where the program starts. Every program must have exactly one main function. If we use more than one main function, the compiler cannot tell which one marks the beginning of the program. The empty pair of parentheses immediately following main indicates that the function main has no arguments (or parameters). The opening brace ‘{‘ in the second line marks the beginning of the function main and the closing brace ‘}’ in the last line indicates the end of the function. The closing brace also marks the end of the program. All the statements between these two braces form the function body. It contains a set of instructions to perform the given task. Role of Main() Function
  • 9. Every ‘C’ program must have one main() section. This section contains two parts, declaration part and executable part. The declaration part declares all the variables used in the executable part. There is at least one statement in the executable part. These two parts must appear between the opening and the closing braces. The program execution begins at the opening brace and ends at the closing brace. The closing brace of the main function section is the logical end of the program. All statements in the declaration and executable parts end with a semicolon. main() function name { start of program -------- program statements -------- } end of program
  • 10. C-TOKENS • Keywords : int, float, while • Identifiers : value, amount • Constant : -15.5 , 100 • Strings : “abc”, “ABC”, “x+y”, ”5”, “d” • Special Symbols : [ ] , { } • Operators : + , - , * , / , % Variable “Variables are data name, which is used to store any kind of value, constant or expression. Or Variables are data names, which value change during the execution of ‘C’ program” Type of Variable :- 1) Integer Variable : x=169 2) Float Variable : x=169.79 3) Character Variable : x=‘k’/”ram” 4) Long integer Variable : {-32768 to 32767}
  • 11. CONSTANT “Constants are fixed values, which does not change during the execution of ‘C’ program” Type of Constant :- 1) Integer Constant : x=169 2) Float/ Real Constant : x=169.79 3) Character Constant : x=‘k’ 4) String Constant : x=“ram” 5) Back Slash Character Constant:: ‘n’, ‘t’, ‘v’ etc. KEYWORD  Keywords are those words whose meaning is already defined know to the compiler.  It is also know as Reserved words.  Keywords are not used as variable name. Keywords are not used as constant name. There are 32 Key-words in “C” Language
  • 12. Types of Keywords In “C” Language 1.auto 2.break 3.case 4.char 5.const 6.continue 7.default 8.do 9.double 10.else 11.enum 12.extern 13.float 14.for 15.goto 16.if 17. int 18.long 19.register 20.return 21.short 22.signed 23.sizeof 24.static 25.struct 26.switch 27.typedof 28.union 29.unsigned 30.void 31.volatile 32.while
  • 13. Data Types in “C” Language “C language is rich in its data types. There are four classes of data types:” 1. Primary or Fundamental data types:- All C compilers support four fundamental data types, namely integer (int), character (char), floating point (float), and double-precision floating point (double). 2. User-defined data types:- typedef, enum are the user-defined data type. 3. Derived data types:- Arrays, functions, structures and pointers are derived data types. 4. Empty data set:- void main()
  • 14. Types of Operators In “C” Language “Operators are used in programs to manipulate data and Variables” There are 8 types of operators in ‘C’ Language- 1) Arithmetic Operators 2) Relational Operators 3) Logical Operators 4) Assignment Operators 5) Increment and decrement Operators 6) Bitwise Operators 7) Conditional Operators 8) Special Operators
  • 15. Branching in “C” Language “C language possesses such decision making capabilities and supports for the following statements known as Control or Decision Making Statements.” A. If statement B. Switch Statement C. Conditional Operator Statement D. GOTO Statement A. If Statement:- 1. Simple If statement 2. If ….. Else Statement 3. Nested If … else Statement 4. Else If Ladder Statement
  • 16. A-1. Simple If A-2. If….else Syntax: If (Test Condition) { Statement Block; } Statement-x; Next Statement; Example: #include<stdio.h> #include<conio.h> void main() { int a,b; printf(“n Enter A and B Value:”); scanf(“%d,%d”, &a, &b); if (a>b) { printf(“n A is Greater=%d”,a); } } Syntax: If (Test Condition) { True Block Statement; } Else { False Block Statement; } Statement-x; Next Statement; E x a m p l e : # i n c l u d e < s t d i o . h > # i n c l u d e < c o n i o . h > v o i d m a i n ( ) { i n t a , b ; p r i n t f ( “ n E n t e r A a n d B Va l u e : ” ) ; s c a n f ( “ % d , % d ” , & a , & b ) ; I f ( a > b ) { p r i n t f ( “ n A i s G r e a t e r = % d ” , a ) ; } e l s e { p r i n t f ( “ n B i s G r e a t e r = % d ” , b ) ; } }
  • 17. A-3. Nested If …. Else Syntax: If (Test Condition- 1) { If (Test Condition- 2) { Statement Block- 1; } Else { Statement Block- 2; }} Else { Statement Block- 3; } Statement-x; Next Statement; Example: #include<stdio.h> #include<conio.h> void main() { int a,b,c; printf(“n Enter A, B and C Value:”); scanf(“%d,%d,%d”, &a, &b, &c); if ((a>b)&& (a>c)) { if (b>c) { printf(“n A is Greater=%d”,a); } else { printf(“n B is Greater=%d”,b); }} else { printf(“n C is Greater=%d”,c); }} A-4. Else if Ladder Syntax: If (Test Condition-1) Statemetn-1; Else If (Test Condition-2) Statement-2; Else If (Test Condition-3) Statement-3; …………………… Else if (Test Condition-n) Statement-n; Else Default Statement; Statement-x; Next Statement; Example: #include<stdio.h> #include<conio.h> void main() { int code; printf(“n 1. Hi n 2. Hello n 3. How are you?”); printf(“n Enter your Choice :”); scanf(“%d”, &code); if (code==1) printf(“n Hi”); else if (code==2) printf(“n Hello”); else if (code==3) printf(“n How are you?”); else printf(“n All the Best”); }
  • 18. B. Switch Statement Syntax: Switch (Test expression) { Case value-1: Block-1; Break; Case value-2: Block-2; Break; ………………… Default: Default block; Break; } Statement-x; Next Statement; Example: #include<stdio.h> #include<conio.h> void main() { int code; printf(“n 1. Hi n 2. Hello n 3. How are you?”); printf(“n Enter your Choice :”); scanf(“%d”, &code); switch(code) { case 1: printf(“n Hi”); break; case 2: printf(“n Hello”); break; case 3: printf(“n How are you?”); break; default: printf(“n All the Best”); break; }}
  • 19. C. Conditional Operator Statement Syntax: Exp1 ? Exp-2 : Exp-3; Example: #include<stdio.h> #include<conio.h> void main() { int a,b; printf(“n Enter A and B Value:”); scanf(“%d,%d”, &a, &b); (a>b) ? printf(“n A is Greater”) : printf(“n B is Greater”); } “It is also known as Ternary Operator. It has three operands”
  • 20. D. GOTO Statement Syntax-1: Forward Jump Goto Label; ………….. ………….. ………….. Label: Statement; Example: #include<stdio.h> #include<conio.h> void main() { int a,x; b: printf(“n Enter A Value:”); scanf(“%d”, &a); if(a<0) { printf(“n Entire value id either Zero or Negative !! Please try again…”); goto b; } else { printf(“n Good Input:”); x=a*a; printf(“n Result is =%d”,x); }} Syntax-2: Backward Jump Label: Statement; ………….. ………….. ………….. Goto Label;
  • 22. Types of loop in “C” Language Three types of loop in “C” Language. “A sequence of Statements are executed until some conditions for termination of the loop are satisfied” 1. While Loop – Entry Controlled Loop. 2. Do Loop - Exit Controlled Loop. 3. For Loop - Entry Controlled Loop.
  • 23. While loop:- Syntax:- While (Test Condition) { Body of the Loop; } Example:- #include<stdio.h> #include<conio.h> void main() { int i=0; while(i<=10) { i=i+1; printf(“n Result is=%d”,i); }} Do loop:- syntax:- Do { Body of the Loop; } while (Test Condition); } Example: #include<stdio.h> #include<conio.h> void main() { int i=0; do { i=i+1; printf(“n Result is=%d”,i); } while(i<=10); } For loop:- Syntax:- For (Initialization; Test Condition; Increment/Decremen t) { Body of the Loop; } Example:- #include<stdio.h> #include<conio.h> void main() { int i; for (i=1; i<=10; i++) { printf(“n Result is= %d”,i); } }
  • 24.  An Array is defined as collection of related items and all the items are as similar data types.  Array are the collection of finite number of similar type data element.  Array handle a large amount of data in terms of reading, processing and printing. Array Types of array in “C” Language One Dimensional Array. Two Dimensional Array. Multi Dimensional Array. Three types of array in “C” Language.
  • 25. Array examples:- 1. One Dimensional Array Example: #include<stdio.h> void main() { int i, a[5]; printf(“n Enter 5 elements :”); for (i=0; i<5; i++) { scanf(“%d”,&a[i]); } printf(“n Output of array elements :”); for (i=0; i<5; i++) { printf(“n %d”,a[i]); }} 2 . Tw o D i m e n s i o n a l A r r a y E x a m p l e : #include<stdio.h> void main() { int i,j, a[3][3]; printf(“n Enter 3 x 3 elements :”); for (i=0; i<3; i++) { for (j=0; j<3; j++) { scanf(“%d”,&a[i][j]); }} printf(“n Output of array elements :”); for (i=0; i<3; i++) { printf(“n”); for(j=0;j<3;j++) { printf(“t %d”,a[i][j]); }}} 3 . M u l t i D i m e n s i o n a l A r r a y Example: #include<stdio.h> void main() { int i,j,k a[2][3][2]; printf(“n Enter 2 x 3 x 2 elements :”); for (i=0; i<2; i++) { for (j=0; j<3; j++) { for (k=0; k<2; k++) { scanf(“%d”,&a[i][j][k]); }} printf(“n Output of array elements :”); for (i=0; i<2; i++) { for(j=0;j<3;j++) { for (k=0; k<2; k++) { printf(“n %d”,a[i][j][k]); }}}
  • 26. STRING “In C language, Array of Characters are called “String”. Any string is the sequential collection of Characters, which used any single data item. String size denotes the maximum number of characters can hold. String value will terminate with an additional null ‘0’ terminator. Hence, at the time of string declaration, one extra element space will define for the null character. Syntax: <data type> <Array Name> [size]; Example Char n[10]; Character string :- ‘w’ ‘e’ ‘l’ ‘l’ ‘ ‘ ‘d’ ‘o’ ‘n’ ‘e’ ‘0’ N[0] N[1] N[2] N[3] N[4] N[5] N[6] N[7] N[8] N[9]
  • 27. Example of string : #include<stdio.h> void main() { char x[50]; printf(“n enter any string”); gets(x); puts(x); }
  • 28. Category of Functions:- 1. Function with No Argument and No Return Value 2. Function with No Argument and Return Value 3. Function with Argument and No Return Value 4. Function with Argument and Return Value Function Function Parameter Passing:- Syntax: Function(a1,a2, a3 .... an) { ---------- ---------- } Function(f,f2,f3, …. Fn) { ---------- ---------- } Example: #include<stdio.h> void main() { int ram(int,int),a,b; printf(“n Enter A and B value :”); scanf(“%d,%d”,&a,&b); printf(“n Result is=%d”,ram(a,b); } int ram(int x, int y) { int z; z=x+y; return (z); }
  • 29. RECURSION Definition: When a function calls a copy of itself then the process is known as Recursion. Or When a function calls itself then this technique is known as Recursion E x a m p l e : # i n c l u d e < s t d i o . h > v o i d m a i n ( ) { i n t n , f a c t ( i n t ) ; p r i n t f ( “ n E n t e r a n y N u m b e r : ” ) ; s c a n f ( “ % d ” , & n ) ; p r i n t f ( “ n F a c t o r i a l v a l u e i s = % d ” , f a c t ( n ) ) ; } i n t f a c t ( i n t n ) { i f ( n = = 0 ) r e t u r n ( 1 ) ; e l s e r e t u r n ( n * f a c t ( n - 1 ) ) ; }