What would be the output of the following program?
main()
{
int y=128;
const int x=y;
printf("%d",x);
}
A) 128
B) Garbage value
C) Error
D) 0
A is correct
main()
{
{
unsigned int bit=256;
printf("%d", bit);
}
{
unsigned int bit=512;
printf("%d", bit);
}
}
A) 256, 512
B) 512, 512
C) 256, 256
D) Compile error
Explanation: because these are different blocks, so declaration is allowed. (A)
Monday, August 17, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment