In my experience, printf()
hauls in more code than puts()
regardless of the format string.
If I don't need the formatting, I don't use printf
. However, fwrite
to stdout
works a lot faster than puts
.
static const char my_text[] = "Using fwrite.\n";
fwrite(my_text, 1, sizeof(my_text) - sizeof('\0'), stdout);
Note: per comments, '\0' is an integer constant. The correct expression should be sizeof(char)
as indicated by the comments.