::NPTEAM:: Network Programer Team

검색 :
RSS 구독 : 글 / 댓글 / 트랙백 / 글+트랙백

[C++] static 변수의 최대값이 넘어갔을때

#include <limits.h>

static int a = INT_MAX -1;
static unsigned int b = INT_MAX * 2 -1;

a++;
b++;
cout << a << " " << b << endl;

a++;
b++;
cout << a << " " << b << endl;

a++;
b++;
cout << a << " " << b << endl;

a++;
b++;
cout << a << " " << b << endl;

결과
2147483647 4294967294
-2147483648 4294967295
-2147483647 0
-2147483646 1
-2147483645 2
-2147483644 3
 
2006/05/13 23:54 2006/05/13 23:54

맨 위로