difference between putchar and puts
Answers
Answered by
61
Heya friend here is your answer
putchar() are single character functions where as puts() are string functions.
putchar() – prints a character to the screen.Example: putchar(b);
where as
puts() – writes a string on the screen and advances the cursor to the newline. i.e. it ends with a new line character. Example:puts("one");
putchar() are single character functions where as puts() are string functions.
putchar() – prints a character to the screen.Example: putchar(b);
where as
puts() – writes a string on the screen and advances the cursor to the newline. i.e. it ends with a new line character. Example:puts("one");
Answered by
12
First 2 functions output a single character to a FILE.
Third function outputs a single character to console.
Last function prints a string to console.
The fputc function writes the character specified by c (converted to an unsigned
char) to the output stream pointed to by stream.
The putc function is equivalent to fputc, except that if it is implemented as a macro and may evaluate stream more than once, so that argument should never be an expression with side effects.
putchar writes the character to the console, and is the same as calling putc(c, stdout).
The puts function writes the null terminated string argument to the stdout stream, and appends a new-line character to the output. The terminating null character is not written.
Third function outputs a single character to console.
Last function prints a string to console.
The fputc function writes the character specified by c (converted to an unsigned
char) to the output stream pointed to by stream.
The putc function is equivalent to fputc, except that if it is implemented as a macro and may evaluate stream more than once, so that argument should never be an expression with side effects.
putchar writes the character to the console, and is the same as calling putc(c, stdout).
The puts function writes the null terminated string argument to the stdout stream, and appends a new-line character to the output. The terminating null character is not written.
Similar questions