What is the size of long long integer in a 32-bit computer?
#include<stdio.h>
int main()
{
unsigned long long var = 0LL;
printf("%d",sizeof(var));
return 0;
}
What is the size of long long integer in a 32-bit computer?
#include<stdio.h>
int main()
{
unsigned long long var = 0LL;
printf("%d",sizeof(var));
return 0;
}
What is the size of long long integer in a 32-bit computer?
The type of computer is irrelevant. The value of the long long variable/object is irrelevant. The issues are the compiler and the C spec.
C requires long long to represent a minimum range or [-9223372036854775807 ... 9223372036854775807], that takes at least 64-bits (See C11dr §5.2.4.2.1 1).
A 32-bit computer will likely use a 64-bit implementation. A future compiler may use 128-bit long long.
When printing, use a matching print specifier "%zu" for the return type of sizeof, which is size_t.
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("size: %zu\n", sizeof(long long));
printf("bit size: %zu\n", sizeof(long long) * CHAR_BIT);
}
printf(sizeof(var)); is invalid code as the first parameter to printf() needs to be a string, not an integer. Insure your compiler warnings are fully enabled.