Download presentation
Presentation is loading. Please wait.
1
Pointers Example Use int main() { int *x; int y; int z; y = 10; x = &y; y = 11; *x = 12; z = 15; x = &z; *x = 5; z = 8; printf(“%d %d %d\n”, *x, y, z); return 1; } x is a pointer to an int follow the pointer at x the address of y
2
Functions and Pointers Call-by-value void f( int x ) { x = 10; return; } #include int main() { int a = 5; f( a ); printf(“%d\n”, a); return 0; }
3
Functions and Pointers Call by reference –Multiple return values void f( int *x ) { *x = 10; return; } #include int main() { int a = 5; f( &a ); printf(“%d\n”, a); return 0; }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.