3

please explain it to me that what is the dfference between puts(string name) and fputs(string name,stdout)

both of them have the same output especially when I use fgets(string name,n,stdin) for get std size of a string for a safe code , but after that and for print to output , what is the difference between them although both of them have the same output?

S MEHDI M
  • 37
  • 1
  • 5

1 Answers1

6

puts appends a newline to the string, and fputs doesn't.

Otherwise there is no difference, except of course that with fputs you can specify a different stream, while puts always writes to stdout.

Nate Eldredge
  • 48,811
  • 6
  • 54
  • 82