From 7998233c9b403d9f922a25fce1d61c5fdab0bc5a Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 8 Sep 2011 22:33:37 -0400 Subject: [PATCH] extra credit for ch. 9 --- ex8.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ex8.c b/ex8.c index f2f1b34..e89e124 100644 --- a/ex8.c +++ b/ex8.c @@ -17,6 +17,10 @@ int main(int argc, char *argv[]) sizeof(areas) / sizeof(int)); printf("The first area is %d, then 2nd %d.\n", areas[0], areas[1]); + areas[0] = 100; + areas[2] = areas[1]; + printf("Now the first area is %d and the 3rd area is %d.\n", + areas[0], areas[2]); printf("The size of char: %d\n", sizeof(char)); printf("The size of name (char[]): %d\n", @@ -35,5 +39,18 @@ int main(int argc, char *argv[]) printf("name[0] is %c.\n", name[0]); printf("full_name[7] is %c.\n", full_name[7]); + name[0] = 'X'; + printf("Now name[0] is %c.\n", name[0]); + + full_name[7] = 'T'; + printf("Now full_name[7] is %c.\n", full_name[7]); + + printf("name=\"%s\" and full_name=\"%s\"\n", + name, full_name); + + areas[2] = name[0]; + printf("First area is now name[0]: %%c=%c, %%d=%d.\n", + areas[2], areas[2]); + return 0; }