Deitel & Deitel, C How to Program 6th Edition, Exercise 9.9 (Printing Pointer Values as Integers)

// 9.9 Printing Pointer Values as Integers

#include <stdio.h>

int main() {
int *aPtr, num;
aPtr = &num; //placing adress of num to aPtr

printf("%%d: %9d", aPtr); //Printing a pointer value with all integer conversion specifiers
printf("-->Prints the adress of number in decimal\n");
printf("%%i: %9i", aPtr);
printf("-->Prints the adress of number in decimal\n");
printf("%%o: %9o", aPtr);
printf("-->Prints the adress of number in octal\n");
printf("%%u: %9u", aPtr);
printf("-->Prints the adress of number in decimal\n");
printf("%%x: %9x", aPtr);
printf("-->Prints the adress of number in hexadecimal\n");
printf("%%p: %9p", aPtr);
printf("-->Prints the adress of number in hexadecimal\n");


printf("\n\n\n");
return 0;
}

Comments

Popular posts from this blog

Deitel & Deitel, C How to Program 6th Edition, Exercise 6.23 (Turtle Graphics)

Deitel & Deitel, C How to Program 6th Edition, Exercise 6.22 (Total Sales)

Deitel & Deitel, C How to Program 6th Edition, Exercise 5.47 (Craps Game Modification)