English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C ++What Are The Differences Between And gcc?

Integer

The data type int is used to store integer values. It can be signed or unsigned. The data type int is32Bitwise OR4bytes. The storage space required for storing values is less than the storage space. The keyword "int" is used to declare an integer variable.

The following is the syntax of the int data type.

int variable_name;

Here,

variable_name-User-defined variable name.

The following is an example of the int data type.

Example

#include <iostream>
using namespace std;
int main() {
   int a = 8;
   int b = 10;
   int c = a+b;
   cout << "The value of c : " << c;
   return 0;
}

Output result

The value of c : 18

Long

The data type long is used to store long integer values. It can be signed or unsigned. The data type long is64Bitwise OR8Bytes. It requires more memory space than int to store values. The keyword "long" is used to declare a long integer variable.

The following is the syntax of the long data type.

long variable_name;

Here,

variable_name-User-defined variable name.

The following is an example of a long data type.

Example

#include <iostream>
using namespace std;
int main() {
   int a = 8;
   long b = 28;
   long c = long(a+b);
   cout << "The value of c : " << c;
   return 0;
}

Output result

The value of c : 36