Thursday, July 30, 2009

Choose the invalid C statement?

a. int a, b=2, c=3


b. char a[ ]="abc",*p=a;


c. a+b=7


d. ++(*p++)

Choose the invalid C statement?
c is invalid because a+b isn't an l-value. The compiler doesn't know where to assign the value of 7. Because the = (assignment operator) is not equivalent to the mathematical = operator, a+b=7 is not valid
Reply:I'd say..... 'c'


No comments:

Post a Comment