Download presentation
Presentation is loading. Please wait.
Published byBruno Logan Modified over 8 years ago
3
Memory setup Pointer declaration Address operator Indirection Printing addresses or pointers
4
int a = 10; float x = 17.24; char c = ‘q’; 10 17.24 ‘q’ a x c (1ab) (2fe) (3cd)
5
int a = 10; float x = 17.24; char c = ‘q’; 10 17.24 ‘q’ 5fb a x c (1ab) (2fe) (3cd)
6
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; 10 17.24 ‘q’ a x c (1ab) (2fe) (3cd) ptr
7
int a = 10; float x = 17.24; char c = ‘q’; cout << a; cout << &a; 10 17.24 ‘q’ a x c (1ab) (2fe) (3cd)
8
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; ptr = &a; 10 17.24 ‘q’ 1ab a x c (1ab) (2fe) (3cd) ptr
9
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; ptr = &a; 10 17.24 ‘q’ 1ab a x c (1ab) (2fe) (3cd) ptr
10
int a = 10; float x = 17.24; char c = ‘q’; int *ptr; ptr = &a; 10 17.24 ‘q’ a x c (1ab) (2fe) (3cd) 1ab ptr
11
#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; }
12
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<* intptr << intptr <<& intptr << endl; 10 y cc (1ab) (4fe)
13
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<*intptr << ptr <<&intptr << endl; ; 10 y cc (1ab) (4fe) intptr
14
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
15
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
16
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; *intptr = 32; cout << y <<*intptr << intptr <<& intptr << endl; 10 32 y cc (1ab) (4fe) 4fe intptr
17
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; cout << y <<*intptr <<intptr<<&intptr << endl; 10 32 y cc (1ab) (4fe) 4fe intptr (55a)
18
int y, cc = 10; int* intptr; intptr = &cc; y = *intptr; cout << y <<*intptr <<intptr <<&intptr << endl; 10 32 y cc (1ab) (4fe) 4fe intptr (55a) Output 10 32 4fe 55a
19
Memory setup Pointer declaration Address operator Indirection Printing addresses or pointers
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.