Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (22 sloc) 879 Bytes
#include <stdio.h>
int main(int argc, char *argv[])
{
int areas[] = {10, 12, 13, 14, 20};
char name[] = "Sam";
char full_name[] = {'S', 'a', 'm', ' ','B','r','e','e','d', '\0'};
printf("The size of an int: %ld\n", sizeof(int));
printf("The size of areas (int[]) %ld\n",
sizeof(areas));
printf("The number of intes in areas: %ld\n",
sizeof(areas) / sizeof(int));
printf("The first area is %d, then the 2nd %d\n",
areas[0], areas[1]);
printf("The size of char %ld\n", sizeof(char));
printf("The size of name (char[]) %ld\n", sizeof(name));
printf("The numbers of chars %ld\n",
sizeof(name) / sizeof(char));
printf("The size of full_name (char[]) %ld\n", sizeof(full_name));
printf("The number of chars: %ld\n", sizeof(full_name) / sizeof(char));
printf("name=\"%s\" and full_name=\"%s\"\n", name, full_name);
return 0;
}