Presented By:
Kirtika Thakur
PROGRAMMING
Presentation on
Topics
Introduction
Control statements
Functions
Arrays
String
INTRODUCTION
 C is a general purpose language which is closely
associated with UNIX for which is developed by Bell
Laborites.
 Most of the program of Unix are written and run with
the help of ‘C’.
 Many of the important idea of ‘C’ stream are form BPCL
by Martin Richard
Cont…
 In, 1972 Dennis Richard at Bell Laborites wrote C
language which cause a revolution in computing world
 From beginning C was intended to be useful for busy
programmers to done easily because C is powerful,
dominate and supple language
Syntax of C Language
#include<stdio.h>
#include<conio.h>
void main()
{
-------
getch();
}
Header File
Main() is function .it is the first function from which the
control statement is passed from os when a program is
executed
Control Statement
Control
Statement
Decision control
Statement
If Else if Nested if
Case control
statement
Switch
Loop control
statement
For loop While loop
If-else statement
Definition:
if (condition) { code when true } else
{ code not true }
Example:
if(A>B)
{
printf (“A is greater”);
}
else
{
printf(“B is greater”);
}
If condition is true if statement will executed if not then
else statement is executed
Nested if statement
It is always legal in C programming to nest if – else
statements, which means you can use one if or else if
statement.
Syntax:
If (boolan_expression 1)
{
printf(“executed when the expression 1 is true ”);
}
If(boolan_expression 2)
{
printf (“executed when the boolean 2 is true”)
For loop
Definition of Function
Function definition include
Function name;
Function type;
Parameter list ;
Declarations of variable;
Function statement;
a return statement ;
All six element are grouped into two parts:
Function header
Function body
Function Header
Function body
The function body contain the declaration and statements
necessary for performing the required task .The body
enclosed in braces , contains three parts,
1.local declaration that specify the variable needed by the
function
2. function statement that perform the task of the function.
3. A return statement that return the value evaluated by
the function.
If a function does not return any value , we can omit the
return statement.
Its return type should be specified as void
Example of function
Program for factorial of a number using function
#include<stdio.h>
#include<conio.h>
Void main()
{
Void factorial (int);
Int num;
Printf(“enter the value of num”);
Scanf(“% d,”& num);
Factorial(num);
Getch();
}
Void fun(int x)
{
int product=1, i;
for(i=x; i>=1; i--)
{
product= product*i;
}
Printf(“%d”, product);
}
Array
An array is a fixed-sequential collection of
element that share some data type and a
common name .
It is simple a group of data type.
An array is a derived data type.
An array is used to represent a list of number,
or a list of names.
Array
Single
Dimension
Array
Two
Dimension
Array
Type of Array
String
String are group of arrays also
called character array strings
always ends with null character.
Syntax of string:-
Data Type variable name [ size];
ex:- int a[20];
Presentation on C language By Kirtika thakur

Presentation on C language By Kirtika thakur

  • 1.
  • 2.
  • 3.
    INTRODUCTION  C isa general purpose language which is closely associated with UNIX for which is developed by Bell Laborites.  Most of the program of Unix are written and run with the help of ‘C’.  Many of the important idea of ‘C’ stream are form BPCL by Martin Richard
  • 4.
    Cont…  In, 1972Dennis Richard at Bell Laborites wrote C language which cause a revolution in computing world  From beginning C was intended to be useful for busy programmers to done easily because C is powerful, dominate and supple language
  • 5.
    Syntax of CLanguage #include<stdio.h> #include<conio.h> void main() { ------- getch(); } Header File Main() is function .it is the first function from which the control statement is passed from os when a program is executed
  • 6.
    Control Statement Control Statement Decision control Statement IfElse if Nested if Case control statement Switch Loop control statement For loop While loop
  • 8.
    If-else statement Definition: if (condition){ code when true } else { code not true } Example: if(A>B) { printf (“A is greater”); } else { printf(“B is greater”); } If condition is true if statement will executed if not then else statement is executed
  • 10.
    Nested if statement Itis always legal in C programming to nest if – else statements, which means you can use one if or else if statement. Syntax: If (boolan_expression 1) { printf(“executed when the expression 1 is true ”); } If(boolan_expression 2) { printf (“executed when the boolean 2 is true”)
  • 11.
  • 13.
    Definition of Function Functiondefinition include Function name; Function type; Parameter list ; Declarations of variable; Function statement; a return statement ; All six element are grouped into two parts: Function header Function body
  • 15.
  • 16.
    Function body The functionbody contain the declaration and statements necessary for performing the required task .The body enclosed in braces , contains three parts, 1.local declaration that specify the variable needed by the function 2. function statement that perform the task of the function. 3. A return statement that return the value evaluated by the function. If a function does not return any value , we can omit the return statement. Its return type should be specified as void
  • 17.
    Example of function Programfor factorial of a number using function #include<stdio.h> #include<conio.h> Void main() { Void factorial (int); Int num; Printf(“enter the value of num”); Scanf(“% d,”& num); Factorial(num); Getch(); } Void fun(int x) { int product=1, i; for(i=x; i>=1; i--) { product= product*i; } Printf(“%d”, product); }
  • 18.
    Array An array isa fixed-sequential collection of element that share some data type and a common name . It is simple a group of data type. An array is a derived data type. An array is used to represent a list of number, or a list of names.
  • 19.
  • 20.
    String String are groupof arrays also called character array strings always ends with null character. Syntax of string:- Data Type variable name [ size]; ex:- int a[20];