Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
Smita Kapse

In C++, there is no direct way to check the environment architecture. There are two Macros for Windows systems, that can be used to check the architecture. These macros are _WIN64, and _WIN32. When the system is 64-bit, then the _WIN64 will be 1, otherwise the _WIN32 will be 1. So using macro checking, we can identify the architecture

Example

#include <iostream>
using namespace std;
int main() {
   #ifdef _WIN64
      cout << "This is 64 bit system" << endl;
   #elif _WIN32
      cout << "This is 32 bit system" << endl;
   #endif
}

Output

This is 64 bit system

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.