1 #include <stdio.h>
2
3 int main()
4 {
5 unsigned long ulData = 0xFFFFFFFD;
6 while(3 != ulData)
7 {
8 printf("ulData = %x/n", ulData ++);
9
10 if(0 == ulData)
11 {
12 printf("Unsigned Long overflow!/n");
13 }
14 }
15 return 0;
16 }
~/testbench> gcc -o ttul ttul.c
~/testbench> ./ttul
ulData = fffffffd
ulData = fffffffe
ulData = ffffffff
Unsigned Long overflow!
ulData = 0
ulData = 1
ulData = 2
2
3 int main()
4 {
5 unsigned long ulData = 0xFFFFFFFD;
6 while(3 != ulData)
7 {
8 printf("ulData = %x/n", ulData ++);
9
10 if(0 == ulData)
11 {
12 printf("Unsigned Long overflow!/n");
13 }
14 }
15 return 0;
16 }
~/testbench> gcc -o ttul ttul.c
~/testbench> ./ttul
ulData = fffffffd
ulData = fffffffe
ulData = ffffffff
Unsigned Long overflow!
ulData = 0
ulData = 1
ulData = 2