extra credit for ch. 9
This commit is contained in:
parent
cfd8e8cca0
commit
7998233c9b
17
ex8.c
17
ex8.c
@ -17,6 +17,10 @@ int main(int argc, char *argv[])
|
|||||||
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]);
|
||||||
|
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 char: %d\n", sizeof(char));
|
||||||
printf("The size of name (char[]): %d\n",
|
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("name[0] is %c.\n", name[0]);
|
||||||
printf("full_name[7] is %c.\n", full_name[7]);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user