What is the difference between printf, sprintf and fprintf?
printf: printf function is used to print character stream of data on stdout console.
printf(const char* str, ...);
sprintf: String print function instead of printing on console store it on char buffer which is specified in sprintf.
sprintf(char *str, const char *string,...);
Sum of 10 and 20 is 30
fprintf: fprintf is used to print the string content in file but not on the stdout console.
fprintf(FILE *fptr, const char *str, ...);
Enter a name GeeksforGeeks Enter a name GeeksQuiz
0. GeeksforGeeks 1. GeeksQuiz
Thank you for reading, i will soon update with scanf, fscanf, sscanf keep tuned. This article is contributed by Vankayala Karunakar. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
My Personal Notes arrow_drop_up
Please Login to comment...