

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- What is the size of int, long type in C++ standard?
- What is the difference between an int and a long in C++?
- Difference Between int and long
- How is the classification of Computer Networks done as per its architecture?
- What is long long in C/C++?
- What is Standard Deviation of Return?
- Hexadecimal literal of type long in Java
- Need of long data type in C
- What is DIX Standard?
- What is the difference between const int*, const int * const, and int const *?
- Get the absolute value of float, int, double and long in Java
- What is the maximum number of threads per process in Linux?
- MySQL index on column of int type?
- What is the usage of ZEROFILL for INT datatype?
- What is the Simplified Data Encryption Standard?
Advertisements