long occupies 4 bytes; long represents a kind of long integer data, which is a basic data type in programming languages. It is the abbreviation of "long int". The default is signed long integer, including 4 bytes, the value range is "-2^31 ~ (2^31 -1)".

#The operating environment of this tutorial: Windows 10 system, version C11, Dell G3 computer.
How many bytes does long occupy?
4.
The long keyword represents a kind of long integer data, which is a basic data type in programming languages. It is the abbreviation of long int. The default is signed long integer type, containing 4 bytes, and the value is The range is: -2^31 ~ (2^31 -1).
The long integer data type is a data type commonly used in programming languages such as C language.
The long integer data type is divided into signed long integer and unsigned long integer. The respective value ranges are as follows:
(1) Long integer type
Type identifier: long[int]
Bytes: 4
Value range on 32-bit machine: -2147483648~2147483647 (-2^31~(2^31- 1))
Portably, write -LONG_MAX-1 ~LONG_MAX
(2) Unsigned long
type Identifier: unsigned long[int]
Bytes: 4
Value range on 32-bit machine: 0~4294967295 (0~(2^ 32-1))
Portably, write 0 ~ ULONG_MAX
Application example
#include <stdio.h>
int main()
{
printf("short=%d\n\n",sizeof(short));
printf("int=%d\n\n",sizeof(int));
printf("long=%d\n\n",sizeof(long));
printf("float=%d\n\n",sizeof(float));
printf("double=%d\n",sizeof(double));
}The output result on a 32-bit machine is:
short=2 int=4 long=4 float=4 double=8
Recommended learning: "C Video Tutorial"
The above is the detailed content of How many bytes does long occupy?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Chinese version
Chinese version, very easy to use

Atom editor mac version download
The most popular open source editor





