Fixing some format sequences to get rid of warnings

This commit is contained in:
Dan Buch 2012-02-11 13:24:36 -05:00
parent 313b7e6e44
commit 1f224f98ef

16
ex8.c
View File

@ -10,10 +10,10 @@ int main(int argc, char *argv[])
'S', 'h', 'a', 'w', '\0' 'S', 'h', 'a', 'w', '\0'
}; };
printf("The size of an int: %d\n", sizeof(int)); printf("The size of an int: %ld\n", sizeof(int));
printf("The size of areas (int[]): %d\n", printf("The size of areas (int[]): %ld\n",
sizeof(areas)); sizeof(areas));
printf("The number of ints in areas: %d\n", printf("The number of ints in areas: %ld\n",
sizeof(areas) / sizeof(int)); sizeof(areas) / sizeof(int));
printf("The first area is %d, then 2nd %d.\n", printf("The first area is %d, then 2nd %d.\n",
areas[0], areas[1]); areas[0], areas[1]);
@ -22,15 +22,15 @@ int main(int argc, char *argv[])
printf("Now the first area is %d and the 3rd area is %d.\n", printf("Now the first area is %d and the 3rd area is %d.\n",
areas[0], areas[2]); areas[0], areas[2]);
printf("The size of char: %d\n", sizeof(char)); printf("The size of char: %ld\n", sizeof(char));
printf("The size of name (char[]): %d\n", printf("The size of name (char[]): %ld\n",
sizeof(name)); sizeof(name));
printf("The number of chars: %d\n", printf("The number of chars: %ld\n",
sizeof(name) / sizeof(char)); sizeof(name) / sizeof(char));
printf("The size of full_name (char[]): %d\n", printf("The size of full_name (char[]): %ld\n",
sizeof(full_name)); sizeof(full_name));
printf("The number of chars: %d\n", printf("The number of chars: %ld\n",
sizeof(full_name) / sizeof(char)); sizeof(full_name) / sizeof(char));
printf("name=\"%s\" and full_name=\"%s\"\n", printf("name=\"%s\" and full_name=\"%s\"\n",