1.

Raju wants to add value 1 to the variable ‘p’ and store the new value in ‘p’ itself. Write four different statements in C++ to do the task.

Answer»

1)P=P+1; 

2) p++;(post increment) 

3) ++p; (pre increment) 

4) p+=1; (short hand in C++)



Discussion

No Comment Found

Related InterviewSolutions