int data type past 32767 in program no error received (program runs)
Hey all, i'm working on a programming question from a website. The question requires me to use a Fibonacci sequence whose values do not exceed four million. My question, to prepare me for the Fibonacci problem, data types:
int signed -32,76 - +32,767
unsigned long 0 - 4,294,967,295
I wrote a quick program, below, with values of int outside of the specified range (-32,767 - +32,767) for int and the program ran & successfully (4000000 was reached). Was wondering what if any error I can expect (any compiler errors initializing a variable that is out of data type size?)
Code:
#include <stdio.h>
int main (void)
{
int limit = 4000000;
int i = 3500000;
while (i < limit)
{
i++;
printf("%d\n", i);
};
return 0;
}