Use puts instead of printf.

The classic "Hello World" example in C is actually often sort of wrong.
While printf(3) does the job, it is inefficient to use, since the
"format string" does not contain any format characters in this particular case.

puts(3) is better suited, since it does not try to interpret format characters,
and as an extra bonus, already appends the trailing newline for us.
This commit is contained in:
Mario Lang
2013-09-05 19:15:03 +02:00
parent 4c4d25f29f
commit 1b66868d5f

2
c/c.c
View File

@@ -1,6 +1,6 @@
#include<stdio.h>
int main(void) {
printf("Hello World\n");
puts("Hello World");
return 0;
}