How to check if the machine running on is 32 or 64 bit in C?

One of the easiest ways to find whether modern processor is 32-Bit or 64-Bit is by understanding the size of generic pointer(void*).

Below is the C code which prints the 32/64 Bit:

#include <stdio.h>
int main()
{
        printf("\r\nIt's %ld bit system\n", sizeof(void *) * 8);
        return 0;
}

Leave a Comment