2. • Introduction
• Types of Tokens
• Operators
• The C character set
• Structure of program
• Data Type
• If else
• Switch case
• Looping
• Array
• Function
3. C is a programming language developed at
A.T & T Bell laboratories of USA in 1972,
designed and written by “Dennis Ritchie”.
C is a structural programming language.
C is highly portable.
A C program is basically a collection of
functions.
5. Keywords are predefined tokens in C. These
are also called reserved words.
Keywords have special meaning to the C
compiler.
C has 32 keywords.
These keywords can be used only for their
intended action
6. Identifiers are distinct names given to program
elements such as constants, variables, etc.
An identifier is a sequence of letters , digits and
the special character ’_’(underscore).
7. A constant is a fixed value that cannot be
altered during the execution of a program.
C constants can be classified into two categories.
Primary Constants
Secondary Constants
8. A string constant is a sequence of characters
enclosed in double quotes.
The characters may be letters , numbers, blank
space or special characters.
9. The term variable is used to denote any value
that is referred to a name instead of explicit
value.
A variable is able to hold different values
during execution of a program, where as a
constant is restricted to just one value.
For example, in equation 2x+3y=10; since x and
y can change, they are variables.
10. An operator is a symbol that tells the computer
to perform certain mathematical or logical
manipulations.
Operators are used in program to manipulate
data and variables. The data items that
operators act upon are called operands.
11. C has four classes of operators
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Bit-wise Operators
C has some special operators-
1. Increment & Decrement Operators
2. Conditional Operators
3. Assignment Operators, etc.
12. There are five arithmetic operators in C.
Operator Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo division
13. Relational Operators are symbols that are used to
test the relationship between two variable and a
consonant.
C has six relational operators.
Operator Meaning
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
== Equal to
!= Not equal to
14. Logical operators are symbols that are used to
combine or negate expressions containing
relational operators.
C has three logical operators.
Operator Meaning
&& Logical AND
|| Logical OR
! Logical NOT
15. The lowest logical element in the memory is bit.
These operators work only with int and char data
types and cannot be used with float and double type.
Following bitwise operators are available in C.
Operator Meaning
- One’s Complement
| Bitwise OR
& Bitwise AND
^ Bitwise Exclusive OR(XOR)
>> Right Shift
<< Left Shift
16. In addition to usual assignment operator=,C has a set of
short hand operators, that simplifies the coding of a
certain type of assignment statement.
It is of the form
var op= exp
Where var is a variable, op is a C binary arithmetic
operator and exp is an expression.
Statement Equivalent Statement
a+=b a= a+b
a-=b a=a-b
a*=b a=a*b
a*=b+c a=a*(b+c)
a%=b a=a%b
a*=a a=a*a
17. The C character set includes the upper case
letters A to Z , the decimal digits 0 to 9 and
certain special characters.
Letters a,b,c,………………z
Digits 0,1,2,3,4,5,6,7,8,9
Special characters ~,.;:?’!”(){}[]/<>=+-
$#@&*%^
18. A simple program for printing a message.
#include<stdio.h>
#include<conio.h>
Void main()
{
clrscr();
printf(“Welcome to C”);
getch();
}
19. 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 defined
20. 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
user itself.
21. The if statement is a powerful decision making
statement .
If…else statement is a extension of the simple if
statement .The general form is:
If(test expression)
{
true-block statement(s)
}
else
{
false-block statement(s)
}
22. It is a control statement that provides a facility for
multiway branching from a particular point.
Syntax:
switch(expression)
{
case labels:
break;
}
23. To execute a set of instructions repeatedly until a
particular condition is being satisfied.
LOOP
For loop while loop Do while loop
24. For loop-
For (initialization; test condition; increment)
{
Body of the loop
}
While loop-
While (test condition)
{
Body of the loop
}
Do while loop-
do
{
Body of the loop
}
25. An array is a collection of elements of the same
data type.
Syntax:
Data type array name [size];
Type of array
1dimensional 2dimensional Multi-dimensional
26. 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