Posted by
Mohammed in
C,
Linux on
February 5, 2010 |
one response
As you know C programming language has different variable types and each of them use different byte size. Do you wonder how to find size of each variable type in C? Look at the program below.
Program:
int main()
{
printf("sizeof(char) == %d\n", sizeof(char));
printf("sizeof(short) == %d\n", sizeof(short));
printf("sizeof(int) == %d\n", sizeof(int));
printf("sizeof(long) == %d\n", sizeof(long));
printf("sizeof(long long) == %d\n", sizeof(long long));
return 0;
}
Output:
sizeof(char) == 1
sizeof(short) == 2
sizeof(int) == 4
sizeof(long) == 4
sizeof(long long) == 8
~mohammed
Leave a Reply
[...] We hit 300 followers. We hit 300 followers and then surpassed it! How awesome is that? … C Programming: sizeof variable types- ~mohammed – mohammedz.com 02/05/2010 As you know C programming language has different variable types [...]