i would like to know how can i prevent user to key in characters in an int option by displaying error?
i've used if else but it cant work...
please help me as i'm new to c programming...
thank u...
i would like to know how can i prevent user to key in characters in an int option by displaying error?
i've used if else but it cant work...
please help me as i'm new to c programming...
thank u...
Check the return value of scanf. Also, read the FAQ on getting a number from the user.
Quzah.
Hope is the first step on the road to disappointment.
thanks for answering but how to check the return value of scanf?
You just check and see what it is. Do you not understand about how functions return values?
scanf
Quzah.
Hope is the first step on the road to disappointment.
thanks for everything... i think i got it now... but mayb a quite stupid way...
well as long as the program works that will do...
Well you could post your attempt, then we can tell you whether you're really on the right track.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.