Memory setup Pointer declaration Address operator Indirection Printing addresses or pointers
int a = 10; float x = 17.24; char c = ‘q’; ‘q’ a x c (1ab) (2fe) (3cd)
int a = 10; float x = 17.24; char c = ‘q’; ‘q’ 5fb a x c (1ab) (2fe) (3cd)
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; ‘q’ a x c (1ab) (2fe) (3cd) ptr
int a = 10; float x = 17.24; char c = ‘q’; cout << a; cout << &a; ‘q’ a x c (1ab) (2fe) (3cd)
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; ptr = &a; ‘q’ 1ab a x c (1ab) (2fe) (3cd) ptr
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; ptr = &a; ‘q’ 1ab a x c (1ab) (2fe) (3cd) ptr
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; ptr = &a; ‘q’ a x c (1ab) (2fe) (3cd) 1ab ptr
#include using std::cout; using std::endl; int main() { int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<* intptr << intptr <<& intptr << endl; return 0; }
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<* intptr << intptr <<& intptr << endl; 10 y cc (1ab) (4fe)
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<*intptr << ptr <<&intptr << endl; ; 10 y cc (1ab) (4fe) intptr
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<*intptr <<intptr <<&intptr << endl; 10 y cc (1ab) (4fe) 4fe intptr
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<* intptr << intptr <<& intptr << endl; 10 y cc (1ab) (4fe) 4fe intptr
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<*intptr << intptr <<& intptr << endl; y cc (1ab) (4fe) 4fe intptr
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; cout << y <<*intptr <<intptr<<&intptr << endl; y cc (1ab) (4fe) 4fe intptr (55a)
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; cout << y <<*intptr <<intptr <<&intptr << endl; y cc (1ab) (4fe) 4fe intptr (55a) Output fe 55a
Memory setup Pointer declaration Address operator Indirection Printing addresses or pointers