I heard that you should avoid leading newlines when using
printf. So that instead of
printf("\nHello World!") you should use
In this particular example above it does not make sense, since the output would be different, but consider this:
printf("Initializing"); init(); printf("\nProcessing"); process_data(); printf("\nExiting");
printf("Initializing\n"); init(); printf("Processing\n"); process_data(); printf("Exiting");
I cannot see any benefit with trailing newlines, except that it looks better. Is there any other reason?
I'll address the close votes here and now. I don't think this belong to Stack overflow, because this question is mainly about design. I would also say that although it may be opinions to this matter, Kilian Foth's answer and cmaster's answer proves that there are indeed very objective benefits with one approach.