본문 바로가기
프로그래밍/C빌드 에러

[C 빌드 에러] error: narrowing conversion of ‘’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]

by Ohdumak 2020. 11. 10.
728x90

[코드]
char code1[4] = {0xa0, 0xa1, 0xa2 ,0xa3};
char code2[1] = {-100};

[에러]

error: narrowing conversion of ‘162’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]

[해결방법]
unsigned char code[4]= {0xa0, 0xa1, 0xa2 ,0xa3};
signed char code2[1] = {-100};

728x90

댓글