+ 1
If an integer value is to be entered through keyboard for direct arithmetic operation, what function should be use? gets,scant ?
If an integer value is to be entered through keyboard for direct arithmetic operation, what function should be use? gets() getchar() scanf() getstring()
2 Respostas
+ 4
If you mean to read the input as an expression e.g. "5*4/3-2+1", rather than numbers then you can use scanf() with %s as format specifier. Having a sufficient sized buffer prepared, you can read the input as string (char array) then you can parse the expression and process them piece by piece.
I read somewhere that gets() is considered unsafe, and getstring() is non standard (cmiiw).
0
gets()