-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex8.c
25 lines (19 loc) · 935 Bytes
/
ex8.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
int main(int argc, char *argv[])
{
int areas[] = {10, 12, 13, 14, 20};
char name[] = "Zed";
char full_name[] = {
'Z','e','d',' ','A','.',' ','S','h','a','w','\0'};
printf("The size of an int: %u\n", sizeof(int));
printf("The size of areas (int[]): %u\n", sizeof(areas));
printf("The number of ints in areas: %u\n", sizeof(areas) / sizeof(int));
printf("The first area is %d, the 2nd %d.\n", areas[10], areas[1]);
printf("The size of a char: %u\n", sizeof(char));
printf("The size of name (char[]): %u\n", sizeof(name));
printf("The number of chars: %u\n", sizeof(name) / sizeof(char));
printf("The size of full_name (char[]): %u\n", sizeof(full_name));
printf("The number of chars: %u\n", sizeof(full_name) / sizeof(char));
printf("name=\"%s\" and full_name=\"%s\"\n", name, full_name);
return 0;
}