In the specification for the print_winner function it says:

If any candidate has more than half of the vote, their name should be printed to stdout and the function should return true.

My solution before reading this was to just use printf and print a winner if there was one, but what is printing to stdout specifically?


When in doubt, read the doc! From man printf


The functions in the printf() family produce output according to a format as described below. The functions printf() and vprintf() write output to stdout, the standard output stream; fprintf() and vfprintf() write output to the given output stream; sprintf(), snprintf(), vsprintf() and vsnprintf() write to the character string str.

| improve this answer | |
  • Ah okay, so I should just use printf as normal which is the same as "printing to stdout"? – TheRealJaboo May 14 at 10:20
  • The alternative is to use fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) and specify the file stream as stdout – Andrew Micallef May 14 at 21:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .