가능한 중복 :
size of int, long, etc
Does the size of an int depend on the compiler and/or processor?
What decides the sizeof an integer?64 비트 시스템에서 sizeof (int)는 무엇이되어야합니까?
나는 64-bit
기계를 사용하고 있습니다.
$ uname -m
x86_64
$ file /usr/bin/file
/usr/bin/file: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, stripped
$
은 내가
4-bytes
로
sizeof(int)
있어, 다음과 같은 프로그램을 실행합니다. 나는
16-
,
32-
및
64-
비트 컴퓨터를 실행 해요 경우
#include <stdio.h>
int main(void)
{
printf("sizeof(int) = %d bytes\n", (int) sizeof(int));
return 0;
}
, 다음은 integer
의 크기가 16-
, 32-
및 64-
비트가 각각 것을 의미하지 않는다?
제 컴퓨터에서 WORD_BIT
은 32
입니다. 64-bit
기기의 경우 64
이 아니어야합니까?
$ getconf WORD_BIT
32
$
그리고, sizeof(int)
는 상기 경우 64-bits
(8 bytes
)이어야한다?
저는 C 인물이 아니지만,'char'을 제외한 모든 것의 크기는 컴파일러에 따라 다르며 반드시 프로세서의 단어 크기는 아닙니다. – Ryan
http://stackoverflow.com/questions/589575/size-of-int-long-etc – Perception
@minitech : char도 컴파일러에만 해당 – Dani