18
SVBIT,GANDHINAGAR(07 5) GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA JAYDIP 130750109125 Subject:-CPU Branch:-EE

GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

Embed Size (px)

Citation preview

Page 2: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

CENTRAL PROCESSING UNIT

ALU

CPU

CU

Page 3: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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.

Page 4: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

‘C‘ PROGRAM STRUCTUREDocumentation

Header files

Constants and Global variables

Void main(){Statement(s)}

User defined functions and procedures with their body

Page 5: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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

Page 6: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

CONSTANTS VARIABLE 1.) Numeric constants 2.) Non Numeric constants

Page 7: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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

Page 8: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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’

Page 9: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

OPERATORS Arithmetic operators Relational operators Logical operators Assignment operators Increment and Decrement

operators Conditional operators Bitwise operators Other special operators

Page 10: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

ARITHMETIC OPERATORS Arithmetic operators are used to

perform arithmetic operations.

OPERATORS NAME

MEANING

+ Add

- Subtract

* Multiply

% Divide

Page 11: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

RELATIONAL OPERATORS Relational operators are used to

compare variables or constants..

OPERATOR NAME MEANING

== Equals

!= Not equal to

> Greater than

< Less than

Page 12: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

LOGICAL OPERATORS

operator name meaning

&& Logical AND

II Logical OR

! Logical NOT

Page 13: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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;

Page 14: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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.

Page 15: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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.

Page 16: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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

Page 17: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

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;

Page 18: GUJARAT KNOWLEDGE VILLAGE Faculty Name:- Prof H.M.Patel Students Name:- SONI VISHAL 130750109111 THAKKER BHAVIN 130750109112 ZALA JAYDIP 130750109124 ZALA

THANK YOU