GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL THAKKER BHAVIN ZALA JAYDIP ZALA JAYDIP Subject:-CPU Branch:-EE
ALU CPU CU
Every ‘C’ PROGRAM HAS TO FOLLOW SPECIFIC STRUCTURE.. ‘C’ program must have at least one function called as main(). o The main() function has control over the other part of the program.
Documentation Header files Constants and Global variables Void main() { Statement(s) } User defined functions and procedures with their body
TYPE SIZE RANGE OF VAL char 1 Bytes -128 to +127 int 2 Bytes to float 4 Bytes 3.4e-38 to 3.4e+38 double 8 Bytes 1.7e-308 to 1.7e+308
1.) Numeric constants 2.) Non Numeric constants
It is a number type of constants. It can be Integer constant or real constant. Integer constant can be positive and negative number. This is a valid number. 15 -345 0 +7463
These are the constants which is represent other than number. They are two types..... 1.) Character constants 2.) String constants Character constants are single character and are enclosed in single quotes. ‘c’ ‘?’ ‘5’
Arithmetic operators Relational operators Logical operators Assignment operators Increment and Decrement operators Conditional operators Bitwise operators Other special operators
Arithmetic operators are used to perform arithmetic operations. OPERATORS NAME MEANING + Add - Subtract * Multiply % Divide
Relational operators are used to compare variables or constants.. OPERATOR NAME MEANING == Equals != Not equal to > Greater than < Less than
operator name meaning && Logical AND II Logical OR ! Logical NOT
operator name meaning a= a + 5; a +=5; a= a -5; a -=5; a= a *5; a *=5; a= a /5; a /=5; a= a %5; a %=5;
++ increment operators -- decrement operators If a is a variable,, then ++a is called prefix increment. If ‘a’ is a variable,, then a++ is called postfix increment.
The files includes at the beginning of ‘C’ program and having an extension.h are called as header files. stdio.h standard input output functions. conio.h console input output functions. string.h string processing functions. math.h mathematical functions ctype.h character type checking functions.
If the operands are of different type, then the operand with a lower type is upgraded to the higher type and then the operation is performed. * / % first priority + - second priority
When user need the type conversion explicitly, then type casting is used. Remember that type conversion is automatic while type casting is explicitly specific by the programmer in the program. The type casting can be specified in followed form. ( type name ) expression;
THANK YOU