>putc() would output 1 character only, and not really useful or effective in this case.
You must have missed the part where he said "in a loop" and "to display each character one at a time". Of course, the question is a bit ambiguous.
Yes that's understood. What my point was. that. putc() outputs one character so if you wish to output words to the console, you'll need to LOOP for each character you wish to output. thus being very ineffective.
puts() would eradicate the need for looping altogether.
Well are you going to design a for loop to loop through and output chars each time? or just call one function to do it. I think we all know which is the most appropriate.
Re-read the original question -- does not say anything about which method is the most effective or requires the least coding. Actually fwrite() will work as well. I think teachers in college ask silly questions like this one just to see if the student has any imaginagion.
>I think we all know which is the most appropriate.
Nope, it seems to just be me. Given the extremely vague requirements, it's hard to say what's most appropriate, but it's easy to imagine an extended requirement of processing each character before printing. Discarding whitespace, for example. If I had my way, we would have pressed for more information from the OP rather than made assumptions left and right.
>No-one will write 10 lines of code of they can write one.
Which explains why bubble sort is so popular. :icon_rolleyes: