how to check machine is 32bit or 64bit linux

C++
uname -a uname -m 

NOTE: It shows if your system is running 32-bit (i686 or i386) or 64-bit(x86_64).
Example 1:
[email protected]:~/Desktop$ uname -m
x86_64     <<<<<<<<<<<<<<this is 64-bit

Example 2:(you can check with 'lscpu' command also)
[email protected]:~/Desktop$$ lscpu
Architecture:          i686	  <<<<<<<<<this is 32-bit
CPU op-mode(s):        32-bit
 
Source

Also in C++: