기본 콘텐츠로 건너뛰기

라벨이 char인 게시물 표시

char도 부호가 있다

#include <stdlib.h> #include <stdio.h> int main(int argc, char* argv[]) { char b = 255; int a = b; printf("%d\n", a); return 0; } 아무런 옵션을 주지 않고 gcc로 컴파일 하면 결과는 -1 이 나온다. 그러나 " -funsigned-char "옵션을 주고 컴파일하면 255 가 나온다. 어떤게 표준이려나? 전자일까? Powered by ScribeFire . 원본 위치: http://purewell.egloos.com/3576438