"int" is signed unless you specify "unsigned". So "static int" would be a signed int that is also static.
Also, I see no reason why it would crash. Once it gets to the max value, incrementing would return some other value but I've never seen C produce a runtime error for an integer overflow.
Huh? Overflow in C doesn't cause a run-time error. Overflow of a signed integer is technically undefined but whatever the result is, it should just keep running.
4 comments
[ 3.3 ms ] story [ 25.3 ms ] threadFirst off counter is of type static int. not unsigned int like the article says. Secondly j is decremented, j isn't even defined.
They are however right that it most likely will crash due to an overflow problem. Though this is not necessarily true.
Also, I see no reason why it would crash. Once it gets to the max value, incrementing would return some other value but I've never seen C produce a runtime error for an integer overflow.