Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

32-Bit or 64-bit OS ??

3.62/5 (13 votes)
19 Sep 2010CPOL 18.9K  
In C++ you can use the size of a pointer to work out what sort of process you're running in:bool is_64_bit(){ return sizeof(void *) == 8;}This has got the advantage of being portable and you don't have to call any OS functions.You can do something similar in C - just return...
In C++ you can use the size of a pointer to work out what sort of process you're running in:

bool is_64_bit()
{
    return sizeof(void *) == 8;
}


This has got the advantage of being portable and you don't have to call any OS functions.

You can do something similar in C - just return an int instead.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)