+ 1
What will happen if C++ Pointer variable is increment?
If i increment an int type of pointer variable then what will increment? The value that it point to? Or the memory size? Answr Please! Example : int a=5; int *ptr; ptr=&a; ptr++; cout<<*ptr; What will be the value of " *ptr " and How ????
1 Answer
+ 7
just next memory
and then cout <<*ptr;
will print garbage value out
since the next address of ptr isn't assigned yet