The document provides an introduction to the C programming language, outlining its key characteristics, structure, data types, control structures like if/else and switch statements, looping, arrays, pointers, structures, and functions. It describes C as a structured, low-level language developed in 1969-1973, and covers basic data types like int, char, and float, as well as derived types like arrays and pointers.
2. CONTENTS
• INTRODUCTION
• CHARACTERSTICS
• STRUCTURE OF PROGRAM
• DATA TYPE
• IF ELSE
• SWITCH CASE
• LOOPING
• ARRAY
• POINTER
• STRUCTURE
• FUNCTION
3. INTRODUCTION
• C language is one of the most popular
computer language today because it is a
structured ,low level ,machine dependent
language
• It is developed by DENNIS RITCHIE in
between 1969 and 1973 at bell labs.
4. CHARECTERISTICS
• There are a small, fixed number of keywords,
including a full set of flow of control
primitives : for, while, if, do while and switch.
• More than one assignment may be performed
in a single statement.
• There are a large number of arithmetical and
logical operators, such as +, +=, ++, &, ~, etc.
5. STRUCTURE OF PROGRAM
• Documentation Section //optional
• Link section //optional
• Defining section //optional
• Global declaration section //optional
• Main function section //Must
{
Declaration part
Executable part.
}
6. • Sub program
section //optional
• Function 1
• Function 2
• Function n
7. WHAT IS DATA TYPE ?
A data type in a programming language is a
set of data values having predefine
characteristics.
there are three classes of data types:
Data Type
Primitive derived user define
8. TYPES OF DATA TYPE
In c language compiler support five
fundamental data type namely integer
(int), character(char), floating
point(float),double and void.
Derived data types are array, structure,
pointer, function.
A user define data type is basically made
by the user itself.
9. IF ELSE STATEMENT
The if statement is a powerful decision making statement .
If ....else statement is a extention of the simple if statement
. The general form is :
if(test expression)
{
true-block statement(s)
}
else
{
false –block statement(s)
}
n
10. SWITCH CASE
It is a control statement that provides a facility
for multiway branching from a particular point.
syntax:
switch(expression)
{
case labels:
break;
}
11. LOOPING
To execute a set of instructions repeatedly until a
particular condition is being satisfied.
LOOP
For While Do while
loop loop loop
12. Syntax of loops
For loop-
For(intialization ; test condition ; increment)
{
Body of the loop
}
While loop- Do while loop-
While(test condition) do
{ {
Body of the loop body of the loop
} }
13. ARRAY
An array is a collection of elements of the same
data type.
Syntax :
data type arrayname[size];
Type of array
1 dimensional 2 dimensional Multi-dimensional
14. POINTER
C allow us to store the address of one variable in
another variable.
Syntax:
data type *ptrname;
STRUCTURE
Binding of different type of data member in a
single entity.
Syntax: struct structurename
{ different datatype
};
15. FUNCTION
A function definition specifies the name of
the function, the types and number of
parameters it expects to receive, and its
return type.
Types of functions
Built in function User define function