I'm relatively new to C and would like to know how to prevent an overflow from input...
So for example, I have:
scanf("%d", &a);
Where a is an integer.
So what I could I do to prevent someone from entering a number that's larger than max integer? Due to the constraints of the problem I'm working on, you HAVE to use scanf
. How do I go about restricting the input?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…