csc141 GDB

Post on 05-Jan-2016

216 views 0 download

description

presentation

Transcript of csc141 GDB

COMSATS Institute of Information Technology (Virtual Campus)

Block F, NISTE Building, H-8/1 Islamabad Pakistan

INTRODCUTION TO COMPUTER PROGRAMMING( CSC 141)

GDB 01

What is functionality of increment (++) operator?

Answer:

SPECIAL OPERATOR: ++

Increment (++) is the value of variable before or after its value is used in an

expression.

Symbol Example Operation

++ x++ Increment after (Post increment)

++ ++x Increment before (Pre increment)

Examples Using ++

Example-1:

int x = 4;

y = x++;

printf ( “X = %d \t “Y = %d “, x, y )

will print X = 5 Y = 4

as x is incremented after assignment operation.

Example-2:

x = 4;

y = ++x;

printf ( “X = %d \t “Y = %d “, x, y )

will print X = 5 Y = 5

as x is incremented before assignment operation.

CSC271 Database Systems