Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C programming/stdio.h/puts

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

puts is a function used to output a string (plus a newline), for example, #include <stdio.h> int main() { puts("welcome to WIKIPEDIA!!!"); } output (on stdout): welcome to WIKIPEDIA!!! Differences from printf: 1. puts prints a newline after the supplied text 2. puts prints the string as is (it does not process % codes). We can also pass a variable to puts, for example, #include <stdio.h> int main() { const char *str = "welcome to WIKIPEDIA!!!"; puts(str); } output: welcome to WIKIPEDIA!!! puts has the following prototype: int puts(const char *str) It will print each byte at str until a null is reached, then print a newline. puts returns the number of bytes written (including the newline), or EOF (if an error occurred.) To print a string without processing % codes, or outputting a newline, try: printf("%s", "welcome to WIKIPEDIA!!!"); deep