정수가 한계를 초과하면 어떻게 될까요? 출력은 3595이며 어떻게 올까요? 그리고 그것은 2 바이트 타입입니까?정수가 더해 지거나 곱 해져서 한계를 초과하면 어떻게됩니까?
#include<stdio.h>
#include<conio.h>
void main()
{
int n=12,res=1;
clrscr();
while(n>3)
{
n+=3;
res*=3;
}
printf("%d",n*res);
getch();
}
관련 : https://stackoverflow.com/questions/3948479/integer-overflow-and-undefined-behavior – Barmar
당신 때문에 정의되지 않은 행동,해야 할 것이 질문에 자신을 (대답하기 위해, 일반적인 응답을 막는다), 당신은 관대하게 printf()에 호출을 추가해야한다. 또한 환경에서 두 번째 질문에 대한 답을 찾으려면'sizeof (int)'를 출력하십시오. – Yunnosch