Try this:
Code:
#include <stdio.h>
int main(void)
{
printf("This box is %d-bit\n", sizeof(long) * 8);
return 0;
}
All this does is multiply the size of a long integer by 8. All GNU systems define a long to be equal to the natural word size of the architecture (i.e. 4 bytes on 32-bit, 8 bytes on 64-bit, etc).
If you're not familiar with compiling, just save it as, say, cpubits.c and do
cc -o cpubits cpubits.c
then run it
./cpubits
To check your endian-ness at the same time, try this:
Code:
#include <stdio.h>
int main(void)
{
int i = 1;
printf("This box is %d-bit, and is %s-endian.\n", sizeof(long) * 8, *((char*)&i) ? "little" : "big");
return 0;
}