Upload
poppy-dickerson
View
214
Download
0
Embed Size (px)
Citation preview
SVBIT,GANDHINAGAR(075)
GUJARAT KNOWLEDGE VILLAGE
Faculty Name:-Prof H.M.Patel
Students Name:-SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112ZALA JAYDIP 130750109124ZALA JAYDIP 130750109125
Subject:-CPUBranch:-EE
CENTRAL PROCESSING UNIT
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.
‘C‘ PROGRAM STRUCTUREDocumentation
Header files
Constants and Global variables
Void main(){Statement(s)}
User defined functions and procedures with their body
DATA TYPES TYPE SIZE RANGE OF
VALchar 1 Bytes -128 to +127
int 2 Bytes -32768 to +32767
float 4 Bytes 3.4e-38 to 3.4e+38
double 8 Bytes 1.7e-308 to 1.7e+308
CONSTANTS VARIABLE 1.) Numeric constants 2.) Non Numeric constants
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
NON NUMERIC CONSTANTS 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’
OPERATORS Arithmetic operators Relational operators Logical operators Assignment operators Increment and Decrement
operators Conditional operators Bitwise operators Other special operators
ARITHMETIC OPERATORS Arithmetic operators are used to
perform arithmetic operations.
OPERATORS NAME
MEANING
+ Add
- Subtract
* Multiply
% Divide
RELATIONAL OPERATORS Relational operators are used to
compare variables or constants..
OPERATOR NAME MEANING
== Equals
!= Not equal to
> Greater than
< Less than
LOGICAL OPERATORS
operator name meaning
&& Logical AND
II Logical OR
! Logical NOT
ASSIGNMENT OPERATORS 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 AND DECREMENT OPERATORS ++ 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.
HEADER FILE 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.
TYPE CONVERSION 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
TYPE CASTING 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