- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the size of int, long type as per C++ standard?
Here we will see what are the sizes of the int and long type data in C++. The sizes are depending on the system architecture and the Operating system.
So in the 32-bit system, the standard is ILP32. In this standard the int, long and the pointer variables are of 32-bits.
For the 64-bit system there are two variations. For Linux Operating system the standard is LP64. Here long and pointer are of 64-bits, but int are of 32-bits. For the Windows operating system, the standard is LLP64. Here long long is 64-bit, but int and long are of 32-bits.
Example
#include <iostream> using namespace std; int main() { cout << "Size of int: " << sizeof(int) * 8 << " bits" << endl; cout << "Size of long: " << sizeof(long) * 8 << " bits" <<endl; cout << "Size of long long: " << sizeof(long long) * 8 << " bits"<< endl; }
Output
Size of int: 32 bits Size of long: 32 bits Size of long long: 64 bits
- Related Articles
- What is the size of int, long type in C++ standard?
- C++ Program to Convert long Type Variables to int
- C++ Program to Convert int Type Variables to long
- What is the difference between an int and a long in C++?
- How to find the size of an int[] in C/C++?
- Implicit return type int in C
- Need of long data type in C
- What is long long in C/C++?
- Is there any need of “long” data type in C and C++?
- Difference Between int and long
- Print a long int in C using putchar() only
- What is difference between int and const int& in C/C++?
- Standard Size of character ('a') in C/C++ on Linux
- MySQL index on column of int type?
- C++ Program to Convert int Type Variables into String

Advertisements