What is the Difference between "printf" and "sprintf"?
Answer Posted / prits
printf : Print formatted data to stdout (function)
sprintf:writes its results to a string instead of stdout
#include <stdio.h>
int main ()
{
char buffer [50];
int n, a=5, b=3;
n=sprintf (buffer, "%d plus %d is %d", a, b, a+b);
printf ("[%s] is a %d char long string\n",buffer,n);
return 0;
}
| Is This Answer Correct ? | 31 Yes | 18 No |
Post New Answer View All Answers
What is the use of map in c++?
In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h
why and when we can declar member fuction as a private in the class?
Is linux written in c or c++?
What is the full form of india?
Can I uninstall microsoft c++ redistributable?
What do manipulators do?
Is c++ a difficult language?
What are the unique features of C++.
What are c++ storage classes?
List the features of oops in c++?
What will the line of code below print out and why?
What is the role of copy constructor in copying of thrown objects?
What are structs in c++?
What are friend functions in C++?