Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
C++ Tutorial
C++ Language Tutorial - Object Oriented Programing - OOPs History of C++
C++ Language Tutorial - Object Oriented Programing - OOPs Structure of C++
C++ Language Tutorial - Object Oriented Programing - OOPs C++ Datatypes
C++ Language Tutorial - Object Oriented Programing - OOPs Variables
C++ Language Tutorial - Object Oriented Programing - OOPs Constants
C++ Language Tutorial - Object Oriented Programing - OOPs Operators
C++ Language Tutorial - Object Oriented Programing - OOPs Control Structures
C++ Language Tutorial - Object Oriented Programing - OOPs Arrays
C++ Language Tutorial - Object Oriented Programing - OOPs Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Class
C++ Language Tutorial - Object Oriented Programing - OOPs Predefined Functions
C++ Language Tutorial - Object Oriented Programing - OOPs I/O Functions
C++ Language Tutorial - Object Oriented Programing - OOPs String, Character Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Mathematical Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Time Date Functions
C++ Language Tutorial - Object Oriented Programing - OOPs Dynamic Allocation
C++ Language Tutorial - Object Oriented Programing - OOPs Utility Functions
C++ Language Tutorial - Object Oriented Programing - OOPs OOP's Concept
C++ Language Tutorial - Object Oriented Programing - OOPs Special Topics
C++ Language Tutorial - Object Oriented Programing - OOPs Type casting
C++ Language Tutorial - Object Oriented Programing - OOPs Feedback
C++ Language Tutorial - Object Oriented Programing - OOPs Ask Your Doubts
 




Long Integer / Int Data Type


Tutorials Cpp

Topic

How is "long int" datatype used in C++?.



Explanation

The "long int" data type is used to represent long integers. The signed range of the "long int" datatype is between -2147483648 to 2147483647 and the unsigned range is between 0 to 4294967295.

Example:

   #include <iostream.h>
   void main()
   {
     unsigned long int l = 31356;
     signed long int s = -31455;
     cout << "Unsigned long integer is:" << l <<'\n';
     cout << "Bytes used by unsigned long int is:"<< 
             sizeof(l) <<'\n';
     cout << "signed long integer is:" << s <<'\n';
     cout << "Bytes used by signed long int is:" << 
             sizeof(s);
    }	

Result:
 Unsigned long integer is:31356
 Bytes used by unsigned long int is:4
 signed long integer is:-31455
 Bytes used by signed long int is:4

In the above example both signed,unsigned values are displayed along with bytes occupied by the "long int" data type.










Note
C++ is one of the most used programming languages in the world. Also known as "C with Classes". Hope you enjoy this tutorial. Do send your feedback or suggestions on this C++ tutorial. This is a copyright content.

Other Links

web hosting