Saturday, February 13, 2010

15

#include< stdio.h >
#define a 4
main()
{
a++;
printf("%d",a);
}

output


Compilation Error:
Lvalue Required.


How?


#define defines a constant not a variable and also 'a' is replaced with '4' while expanding code.
a++; will be 4++;. we can't increment constant value(4=4+1).
NOTE:constant won't changes its value.
variable can change its value.

0 comments:

Post a Comment