lesson 5 overflow c
[[lesson_5_overflow_c]] last edit on Aug 8, 2005 4:37 AM by rescued_by_c

[user02@FC4 Lesson05]$ cat -n overflow.c
   1  #include <stdio.h>
   2
   3  int main(void)
   4  {
   5     int positive = 40000;
   6     long big_positive = 4000000000;
   7     char little_positive = 210;
   8
   9     printf("positive now contains %d\n", positive);
  10     printf("big_positive now contains %ld\n", big_positive);
  11     printf("little_positive now contains %c\n", little_positive);
  12
  13     return 0;
  14  }
[user02@FC4 Lesson05]$ gcc -o overflow overflow.c
overflow.c: In function ?emain?f:
overflow.c:6: warning: this decimal constant is unsigned only in ISO C90
[user02@FC4 Lesson05]$ ./overflow
positive now contains 40000
big_positive now contains -294967296
little_positive now contains O