Thursday 13 September 2007

good questions of c with answer



Volatile modifier keyword
questions in c programming language:

(q) What will be output of the
following program?



void main()

{

volatile a=5;

a=~a+ ++a;

clrscr();

printf("%d",a);

getch();

}

Output: -1

Explanation: 

Volatile variable can be modifying by interrupt or other
process in preprocessor. So in normal output will not affect.

Note. ~ is one’s complement operator



(q) What

No comments:

Post a Comment