Sunday, August 2, 2009

Assume pint is a pointer variable.For each of the following statements,determine if vald on invalid?

If invalid explain why?


a)pint++;


b)--pint;


c)pint /= 2;


d)pint *=4;


e)pint += x; // Assume x is an int.

Assume pint is a pointer variable.For each of the following statements,determine if vald on invalid?
Technically they are all valid - some simply don't make any sense





a - advance pointer


b - decrement pointer


c - divide pointer by 2; I can't think of a valid reason to do this


d - multiply pointer by 4; again I can't think of a reason one would do this


e - this could be reasonable - add some offset to the pointer; like go to the next part of an array


No comments:

Post a Comment