csc141 gdb

2
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; CSC27 1 Database Systems

Upload: mustafa-kazmi

Post on 05-Jan-2016

216 views

Category:

Documents


0 download

DESCRIPTION

presentation

TRANSCRIPT

Page 1: 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