[Solved] C strings behavior, and atoi function

The problem is indeed here. char instring[2]; Now let’s think about this line. gets(instring); Let’s say you type 10 and hit enter. What will go into instring is three bytes. 1 0 A terminating null. instring can only hold two bytes, but gets will shove (at least) three in anyway. That extra byte will overflow … Read more