how to check machine is 32bit or 64bit linux

uname -a uname -m 

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

Example 2:(you can check with 'lscpu' command also)
durga@ubuntu:~/Desktop$$ lscpu
Architecture:          i686	  <<<<<<<<<this is 32-bit
CPU op-mode(s):        32-bit

Also in C++: