Well, for a homework I don't think you really need to worry about flushing your data after reading something in just because you did not want to overflow in your input. I agree in professional world they should be avoided.
Besides, gets() and scanf() are not functionally identical. scanf() splits … Read More
[QUOTE=WaltP;1148750][ICODE]gets() [/ICODE]and [ICODE]scanf("%s", ...)[/ICODE] are functionally identical. [url=http://www.gidnetwork.com/b-56.html]See this[/url] to understand why you [B]never[/B] use either.[/QUOTE]
scanf() does accept width doesn't it? It can be made safe to use to read a string by just adding width to the string specifier, but not gets() Read More
That seems reasonable, but what if the buffer is 20 characters and the user only enters 4 and hits enter? Read More
[QUOTE=jonsca;1151746]That seems reasonable, but what if the buffer is 20 characters and the user only enters 4 and hits enter?[/QUOTE]
What would the value of [ICODE]strlen()[/ICODE] return in that case? Read More
Whew, for some reason I confused C with objective-c .. of course the array isn't an Object and doesn't have 'size' or 'length'. I feel silly - Next time I'll compile first. Neat trick WaltP.
edit: just so the OP doesn't copy paste, there is a typo in Walt's snippet, … Read More
[QUOTE=sidespell;1155500]hello there, you are apparently getting closer to the success of your program.
Would it be alright to suggest? I bet you can also use fflush(stdin); before your first gets() statement. That will help you in your future encounter towards string inputs.
You are the one that will … Read More
[QUOTE=WaltP;1155862]In other words, [url=http://www.gidnetwork.com/b-56.html]gets()[/url] and [url=http://www.gidnetwork.com/b-57.html]fflush()[/url].
It's good to give an explanation, not just tell people something and they just have to believe you. None of us have credibility to new posters.[/QUOTE]
That's why you are here.
On the other hand I only give what I want to give. A … Read More
Funny thing, Walt, i've noticed your own recent posts where you do exactly the same thing.
such as this one here, where your only response to some guy's crap code was to tell him that it's full of problems and he needs to refrain from posting.
[QUOTE=WaltP;1151442]Please ignore yila's code. … Read More
[QUOTE=WaltP;1156083]Why google for something they don't believe is a problem? Just because someone says don't is not enough of a reason.[/QUOTE]
And that's not my problem. I don't post for the ignorant that doesn't care of being ignorant, but rather for that one coming behind, reading much later, wanting to … Read More