C Programming Lab
C Programming Lab
M.K.B.NAGAR
CSC COMPUTER EDUCATION,
M.K.B.NAGAR
Session Objectives
Discuss the Origin of C
Features of C
Characteristics of C
Current Uses of C
Character Set
Economy of Expressions
Modern Control Flow and Structures
Rich Set of Operators
It is Well suited for writing both System
Software like Operating Systems,
Interpreters, Editors and Assembly
Programs
Language
Developing database Systems
Graphics Packages
Spread Sheets
Word Processors
Office automation
Scientific/Engineering Applications
CAD/CAM Applications
CSC COMPUTER EDUCATION,
M.K.B.NAGAR
Preprocessor Directives (Incl. headerFile)
Global Variable Declarations;
void main()
{
Local Variable Declarations;
Input/Output Statements;
}
Note :
Every “C” Statements should end with Semicolon(;)
CSC COMPUTER EDUCATION,
M.K.B.NAGAR
The C Program Structure
Syntax : #include<headerfilename.h>
Examples: #include<stdio.h>
#include<conio.h>
Stdio -> Standard Input/Output
Conio -> Console Input/Output
Void -> Keyword. It Means Returns Nothing.
main() -> It is a function name which can be used to
indicate the beginning of the program
CSC COMPUTER EDUCATION,
M.K.B.NAGAR execution
C has 32 keywords.
These keywords combined with a formal syntax form a C
programming language.
Instructions
Keywords
Constants,
variables &
Data Types
Alphabets,
Digits,Special
Characters
CSC COMPUTER EDUCATION,
M.K.B.NAGAR
A Character denotes an alphabet, digit or a special
character. These characters can be combined to form variables.
Digits – 0,1,2,3,…7,8,9
backslash
K5.ico ANIMATAY006.ICO
Data type Variablename;
Valid Examples :
CSC avg_val m1
Chennai Anu mark_1
2.Enumerated Datatype
Example :
enum mon{jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec };
All variables must be declared in the program before all executable statement
Every C program must contain atleast one function which must be a main()