23 lines
893 B
C
23 lines
893 B
C
#include <stdio.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int array[] = { 1, 2, 3, 4, 5 };
|
|
char name[] = "Thomas";
|
|
|
|
printf("The size of a short is : %ld\n", sizeof(short));
|
|
printf("The size of an int : %ld\n", sizeof(int));
|
|
printf("The size of a long is : %ld\n", sizeof(long));
|
|
printf("The size of a long long is : %ld\n", sizeof(long long));
|
|
printf("The size of a float is : %ld\n", sizeof(float));
|
|
printf("The size of a double is : %ld\n", sizeof(double));
|
|
printf("The size of areas (int[]) : %ld\n", sizeof(array));
|
|
printf("The number of ints in array: %ld\n",
|
|
sizeof(array) / sizeof(int));
|
|
printf("The size of a char : %ld\n", sizeof(char));
|
|
printf("The size of name (char[]) : %ld\n", sizeof(name));
|
|
printf("The number of chars : %ld\n", sizeof(name) / sizeof(char));
|
|
|
|
return 0;
|
|
}
|