- Code: Select all
it has a bug.....since scanf ignores white spaces....your module wont stop until it reached end of file.
Meanwhile, gets function stops when it encounters '\n' or carriage return '\r'. So....your code cannot get one line at a time. Ex :
What if the input is more than one line?
Like this sample
Using your module.... string a will contain "sample".
But using gets function, a contain "What if the input is more than one line?"
Then....the program starts to process the string to get the proper output
before gets another line.
Hope i'm right,