- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Difference Between int and long
In this post, we will understand the difference between ‘int’ and ‘long’ types.
int
It is a datatype.
It has 32-bits.
In terms of bytes, it takes up 4 bytes.
In Java, it is between the range –2,147,483,648 to 2,147,483,647.
It is also used as a keyword to declare variable of type integer.
In comparison to memory required to store ‘long’ variables, it takes up less memory space.
long
It is a data type.
It takes 64-bits.
In terms of bytes, it takes 8 bytes.
In Java, its range is between –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
It can also be used as a keyword to declare a variable of type ‘long’.
Its memory space requirement is more in comparison to ‘int’.
- Related Articles
- What is the difference between an int and a long in C++?
- Difference between const int*, const int * const, and int const * in C
- Difference between const int*, const int * const, and int const * in C/C++?
- What is the difference between const int*, const int * const, and int const *?
- What is difference between int and const int& in C/C++?
- Difference between “int main()” and “int main(void)” in C/C++?
- C/C++ difference's between "int main()" and "int main(void)"
- Difference between MySQL BigInt(20) and Int(20)?
- Difference between an Integer and int in Java
- Difference between Long Haul and Short Haul
- Difference between Long-Term and Short-Term Scheduler.
- What is the difference between size_t and int in C++?
- Difference between void main and int main in C/C++
- What is the difference between int and integer in MySQL?
- What is the difference between int and Int32 in C#?

Advertisements