// console1.cpp : Defines the entry point for the console application. // #include void pbv( int ); // Pass by Value void pba( int * ); // Pass by Address void rbr( int & ); // Receive by Reference void pba1( int * ); // Pass by Address void pap( int ** ); // Pass Address of Pointer int b = 0xB; int main(int argc, char* argv[]) { printf("Demonstrating Pointers!\n\n"); int a = 0xA; printf("Before, a = 0x%.8x\n", a ); pbv( a ); printf("After, a = 0x%.8x\n\n", a ); printf("Before, a = 0x%.8x\n", a ); pba( &a ); printf("After, a = 0x%.8x\n\n", a ); printf("Before, a = 0x%.8x\n", a ); rbr( a ); printf("After, a = 0x%.8x\n\n", a ); int *pA = &a; printf("Before, a = 0x%.8x\n", *pA ); pba1( pA ); printf("After, a = 0x%.8x\n\n", *pA ); printf("Before, a = 0x%.8x\n", *pA ); pap( &pA ); printf("After, a = 0x%.8x\n\n", *pA ); return 0; } void pbv( int x ) { x = x * 2; } void pba( int *x ) { *x = *x * 2; } void rbr( int &x ) { x = x * 2; } void pba1( int *x ) { printf("\tBefore, a = 0x%.8x\n", *x ); x = &b; printf("\tAfter, a = 0x%.8x\n", *x ); } void pap( int **x ) { printf("\tBefore, a = 0x%.8x\n", **x ); *x = &b; printf("\tAfter, a = 0x%.8x\n", **x ); }