I am learning C and I read in the Kernighan&Ritchie's book that integers int were included in a set specific set [-32767;32767]. I tried to verify this assertion by writing the following program which increment a variable count from 1 to the limit before it fall in negative numbers.
#include <stdio.h>
int main(void){
    int count = 1;
    while(count > 0){
        count++;
        printf("%d\n", count);
    }
    return 0;
}
And surprisingly I got this output:
1
......
2147483640
2147483641
2147483642
2147483643
2147483644
2147483645
2147483646
2147483647 -> This is a lot more than 32767?!
-2147483648 
I do not understand, Why do I get this output? And I doubt M. Ritchie made a mistake ;)
 
     
    