Quote Originally Posted by monarch_dodra View Post
PS: Even if they say "C or C++", sticking to C like code tends to give that "newbie out of college" feeling. You want to prefer C++: Using the standard C++ libraries, you'll hugely improve your overall productivity and code robustness. I highly recommend you learn to use the STL's iostream, algorithm and collections libraries: Most of these "test programs" *need* you to be productive with these.


the standard library is extremely flexible and the fact you don't need to deal with a lot of details (and in particular nasty little bugs you'll get called out for such as forgetting a delete) means that particularly for smaller type apps you have more time to wory about the code that matters rather than the details that don't.
I'll agree with monarch... when given the choice... prefer C++ just because of the fact you'll be on your way to get working.

Your OP doesn't even have the sorting done. Consider the effort it would take to write a dynamic array of strings in C with all the associated memory management and a sorter that works with that (C-style qsort() ... shiver...)...
You could decide to do that bit with C++, but then you're mixing your prefered C and a handfull of C++ where C falls short leading to a hybrid mix of some C and C++... Things like that don't help your assesment :-)