Professional Documents
Culture Documents
Data Type: Sources
Data Type: Sources
Data Type: Sources
http://www.tutorialspoint.com
http://www.wikipedia.com
Data Type
• Data Type is a classification of data which tells the
computer system about the type of value that is stored
in a variable.
• It specify the Minimum and Maximum value that can be
stored in a variable.
• Also it tells about the different type of mathematical,
relational,
and logical operations that can be performed on the
variable.
• Example: int, long, float, etc.
Format Specifier
• It is a special combination of characters that is used to tell the
compiler what kind of value we want to print or read.
• It is used in association with the printf() and scanf() functions.
• It usually starts with a percent(%) symbol.
• Example: %d, %f, %c, etc.
Type of Statements
• Expression Statements.
• Compound Statements.
• Iterative Statements.
• Jump Statements.
• Decision Making Statements.
Expression Statement
It is combination of variables, Constants, operators, Function
Calls and followed by a semicolon. Expression can be any
operation like Arithmetic operation or Logical Operation.
Few Examples for expression Statements :
X = Y + 10 ;
20 > 90;
a?b:c;
a = 10 + 20 * 30;
Compound Statement
Compound statement is combination of several expression
statements.
They are enclosed within the Braces { }.
Compound statement is also called as Block Statement.
Example:
{
int a=10, b=20, c;
c = a + b;
printf(“value of C is : %d ”, c);
}
Iterative Statement
These are also called as Loops. If we want to execute a part
of program many times we will use loops.
Example:
for, while, do-while loops
Jump Statements
These statements are useful for Transfer the Control from
one part of program to other part of Program.
Example:
goto, continue, break, return
If Statement
• An if statement is a decision making
statement, if proved true, performs a function or
displays information otherwise does nothing.
If Else Statement
• An if statement can be followed by an
optional else statement, which executes when the
condition in if is false.
If Else If Statement
• An if statement can be followed by an optional else
if...else statement, which is very useful to test various
conditions using single if...else if statement.
• When using if...else if..else statements, there are few
points to keep in mind −
An if can have zero or one else's and it must come
after any else if's.
An if can have zero to many else if's and they must
come before the else.
Once an else if succeeds, none of the remaining else
if's or else's will be tested.
Logical Operators
• These operators are used to perform logical operations
on the given expressions.
• There are 3 logical operators in C language. They are,
logical AND (&&), logical OR (||) and logical NOT (!).