int * x = new int[10];
x++; //it will increments the pointer by 2 bytes
char* y = new char[10];
x++; // it will increments the pointer by 1 byte
How pointers are moved during address addition or address subtraction operation ?
they will use sizeof() operator to find the size of it and added it.
For Example
int * x = new int[10];
++x;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment