Thursday, July 9, 2009

Char const *p = 'd';Which of the following is not a permissible operation(a) *p++(b) ++p(c) (*p)++(d) All

(*p)++ is definitely illegal.


*p++ is a question of operator precedence and since ++ (post increment) is higher than *p. so it actually becomes *(p++) which is legal.





I also doubt the validity of


char const *p = 'd';

Char const *p = 'd';Which of the following is not a permissible operation(a) *p++(b) ++p(c) (*p)++(d) All
a
Reply:(b) ++p...
Reply:(b)++p
Reply:char const *p = 'd' (Means that things pointed to by p cannot be changed, but p itself can be changed.)





So, (*p)++ is not permissible.


No comments:

Post a Comment