Introduction To C Programming
Introduction To C Programming
Introduction to C Programming
▪ C was originally developed in the 1970s, by Dennis Ritchie at Bell Telephone
Laboratories, Inc.
▪ C contains certain additional features that allows it to be used at a lower level , acting as
bridge between machine language and the high level languages.
BCPL C95
K & RC
(1967) (1995)
Traditional C99
B (1970)
C (1972) (1999)
Program
• Local declaration
int main() – return 0
• Statement – Executable part
4. Subprogram Section- void sum ()
user defined function
Structure of C Program
Pre-processor Directives Example
Global Declaration
#include <stdio.h>
main () int main ()
{
{
Local Declaration printf(“/n Welcome to the World of C:”);
Statements
return 0;
} }
Function 1()……N()
{ Output:
Local Declaration Welcome to the World of C:
Statements
}
How to Program
▪ Input to numbers
A, B C =A+ B C
Input Processing Output
Program – Example
(Add two Numbers)
#include<stdio.h>
Function Header C program basically consists of
#include<conio.h>
void main() Main Function the following parts −
{
int a,b,sum; Local Declaration ▪ Preprocessor Commands
clrscr();
printf(“Enter the Two Numbers: “); ▪ Functions
scanf(“%d%d”,&a,&b); Function Statement
Or
▪ Variables
sum=a+b;
Function Body
printf(“Sum=%d”,sum); ▪ Statements & Expressions
getch();
} ▪ Comments
Thank You