I have to add numbers with this script:
for(i=1; i<1000 ;i++)
sum=sum+i;
it will overflow at 32768 and after that it goes to -32768 because it cant exceed the 16 bit limit.
i want to count the overflows with an int c.
Thanks
I have to add numbers with this script:
for(i=1; i<1000 ;i++)
sum=sum+i;
it will overflow at 32768 and after that it goes to -32768 because it cant exceed the 16 bit limit.
i want to count the overflows with an int c.
Thanks
You can check if sum > sum + i