CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
if you feel below code is right to find out system configuration of 32 or 64 bit, you are mistaken
Reason is that sizeof is compile time evaluation
so if this code is built on 64 bit and exe is shared to system having 32 bit, it will still show output as 64 bit.
to get rid off this issue, just do declare value of some variable and calculate size. is this safe to do ?
*/
#include <iostream>
using namespace std;
int main()
{
size_t size = sizeof(void*);
if (size==8)
cout << "64 bit system";
else if(size==4)
cout << "32 bit system";
else
cout << "Strange";
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run