간단한 질문 : scanf가 ANSI C의 부호없는 문자에 "작은 정수"를 읽거나 받아 들일 수 있습니까?ANSI C (ISO C90) : scanf는 부호없는 char을 읽거나 받아 들일 수 있습니까?
$ gcc -Wall -ansi -pedantic -o un_char un_char.c
un_char.c: In function ‘main’:
un_char.c:8: warning: ISO C90 does not support the ‘hh’ gnu_scanf length modifier
hh
는 ISO C90에 의해 지원되지 않습니다
예 코드 un_char.c는 :으로
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned char character;
scanf("%hhu", &character);
return EXIT_SUCCESS;
}
집계. 따라서이 상황에서 scanf 변환을 사용할 수 있습니까?
Windows에서 코드를 작동시킬 필요가 없으면'-ansi'를'-std = c99'로 변경하십시오. – zwol