강의

멘토링

커뮤니티

Inflearn Community Q&A

moschovy2456's profile image
moschovy2456

asked

Learn C Programming by Following Along with Hong Jeong-mo

3.6 Integer Overflow

The argument has type 'unsigned long'

Written on

·

1.2K

0

안녕하세요!
 
맥 터미널로 공부하고 있는 학생입니다!

다름이 아니라 sizeof 연산자 사용 부분에서

printf("%u", sizeof(unsigned int)); 를 출력하면

format specifies type 'unsigned int' but the argument has type 'unsigned long'라는 오류 메시지가 뜹니다!

바쁘시겠지만 잘부탁드리겠습니다!

c언어c홍정모

Answer 1

1

안녕하세요 :)

찾아보네,

맥에서 사용하는 컴파일러(VCC)에서는

sizeof 연산자의 리턴값이 unsigned long이기 때문이라고 하네요!

 

%u가 아닌 %lu로 출력해보세요 :)

 

참고

https://velog.io/@khh180cm/C-sizeof-warning-%EC%97%90%EB%9F%AC

moschovy2456's profile image
moschovy2456

asked

Ask a question