+ 1

C on x86 question

On the x86 architecture is a long int 32 or 64 bits long??? Or do I have to use long long int for 64 bit arithmetic?

4th Jul 2019, 5:01 AM
Rick Shiffman
Rick Shiffman - avatar
6 ответов
+ 3
~swim~, thanks for the info
4th Jul 2019, 7:01 PM
Rick Shiffman
Rick Shiffman - avatar
+ 2
Hi Everybody, I have been investigating integer sizes on my Macbook Pro dual core x86 laptop and here are the resaults. --------------------------------------------------- int main( int argc, char *argv[]) { printf("\nSize of the defferent basic data types in bytes\n"); printf("Size of char in bytes is: %u\n", sizeof(char)); printf("Size of short in bytes is: %u\n", sizeof(short)); printf("Size of int in bytes is: %u\n", sizeof(int)); printf("Size of long in bytes is: %u\n", sizeof(long)); printf("Size of long long in bytes is: %u\n", sizeof(long long)); printf("Size of float in bytes is: %u\n", sizeof(float)); printf("Size of double in bytes is: %u\n", sizeof(double)); return( 0 ); } //sizeofprinter.c [RicksMacBookPro:~/src/C folder] rrs% /Users/rrs/src/C\ folder/sizeofprinter Size of the defferent basic data types in bytes Size of char in bytes is: 1 Size of short in bytes is: 2 Size of int in bytes is: 4 Size of long in bytes is: 8 Size of long long in bytes is: 8 Size of float in bytes is: 4 Size of double in bytes is: 8 [RicksMacBookPro:~/src/C folder] rrs% ------------------------------------------------ printf("Size of long long in bytes is: %u\n", sizeof(long long)); causes complier errors on sololearn. I guess windows machines don't like the long long int type.
6th Jul 2019, 6:21 PM
Rick Shiffman
Rick Shiffman - avatar