1.

Read the C++ statements given below and answer the following questions:int ar[] = {34,12, 25,56, 38};int *p = ar; (a) What will be the content of p? (b) What is the output of the expression: *p + *(ar+2)? (c) The statement ar++; is invalid. Why? How does it differ from p++;?

Answer»

(a) 34 

(b) *p=34 and *(ar+2)=25

then *p+*(ar+2)=34+25=59. 

(c) ar++ is invalid but p++ valid, p is the pointer, pointer arithmetic is allowed.



Discussion

No Comment Found