+ 1
Why should we yous gets() and puts() function instead of using scanf() and printf()?
it is same or different function?
2 odpowiedzi
+ 16
scanf() considers an input upto whitespace, and gets() take upto a new line. Suppose the user input is "Hello World",
gets() will take "Hello World"
scanf() will take "Hello"
puts() appends a new line after the string output, but printf() doesn't.
+ 5
It might be better to use gets() and puts() when you are working with char arrays. But you should avoid using gets() because it can cause errors, so use fgets() instead.
Read this why you shouldn't use gets(): http://stackoverflow.com/questions/4346598/gets-function-in-c