난 그냥 프로그래밍 퍼즐을했습니다. 왜 똑같습니까?두 변수의 비교
#include <stdio.h>
#include <limits.h>
int main(int argc, char *argv[])
{
unsigned int x = ULONG_MAX;
char y = -1;
if (x == y) printf("That is same.");
return 0;
}
부호없는 int가 부호있는 char로 변환되므로 -1이됩니다. 서명 된 유형과 서명되지 않은 유형을 비교하는 표준이 될 수 있습니다. 모르겠다 ...
이 숙제가 있습니까? 그렇다면 [tag : 숙제] 태그를 사용하십시오. –
아니요. ;-) – RePRO
이 http://stackoverflow.com/questions/6636793/what-are-the-general-rules-for-comparing-different-data-types-in-c –