Created
January 16, 2013 23:53
-
-
Save linkdd/4552150 to your computer and use it in GitHub Desktop.
long is a shortcut to long int, short is a shortcut to short int, char is a type, long long doesn't exist in C90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main (int argc, char **argv) | |
{ | |
printf ("char: %lu\n", sizeof (char)); | |
printf ("short: %lu\n", sizeof (short)); | |
printf ("int: %lu\n", sizeof (int)); | |
printf ("long: %lu\n", sizeof (long)); | |
printf ("long long: %lu\n\n", sizeof (long long)); | |
printf ("char int: %lu\n", sizeof (char int)); // two or more data types in declaration specifiers | |
printf ("short int: %lu\n", sizeof (short int)); | |
printf ("long int: %lu\n", sizeof (long int)); | |
printf ("long long int: %lu\n\n", sizeof (long long int)); | |
return EXIT_SUCCESS; | |
} | |
/* | |
# gcc -ansi -pedantic -Wall -Werror ints.c 0 (GOLDORAK) | |
ints.c: In function ‘main’: | |
ints.c:10:49: error: ISO C90 does not support ‘long long’ [-Werror=long-long] | |
ints.c:12:46: error: two or more data types in declaration specifiers | |
ints.c:15:53: error: ISO C90 does not support ‘long long’ [-Werror=long-long] | |
cc1: all warnings being treated as errors | |
# | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment