What is the Difference between "printf" and "sprintf"?
Answers were Sorted based on User's Feedback
Answer / nelson
The only difference between sprintf() and printf() is that
sprintf() writes data into a character array, while printf
() writes data to standard output device.
|Is This Answer Correct ?||118 Yes||10 No|
Answer / guest
prinf will print the data on to the screen.
sprintf will print the data to a buffer.
basically sprintf is used for formatting the output.
|Is This Answer Correct ?||91 Yes||18 No|
Answer / prits
printf : Print formatted data to stdout (function)
sprintf:writes its results to a string instead of stdout
int main ()
char buffer ;
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);
|Is This Answer Correct ?||31 Yes||18 No|
Answer / namitha
printf is used to write the data in its format.
sprintf is used to write formatted data to string.
|Is This Answer Correct ?||21 Yes||8 No|
Answer / praveen
printf writes the data to console
sprintf writes the data to an array
|Is This Answer Correct ?||5 Yes||5 No|
Answer / lavanya
printf funtion is to write the output to stdout.
sprintf function is to store romatted input output on a
|Is This Answer Correct ?||11 Yes||13 No|
Answer / ramanji
printf() is used to send the output to the output consoled
and the sprintf() is send the output to the specified file
that will be given in the parameters
|Is This Answer Correct ?||8 Yes||11 No|
Can class objects be passed as function arguments?
What are inline functions?
Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).
Explain the concept of copy constructor?
What is the use of main function in c++?
Explain all the C++ concepts using examples.
What is #include iostream in c++?
What is virtual constructor paradigm?
Define a pointer to a data member of the type pointer to pointer?
Write a C++ program that asks the user to choose a number between 1 and 1000. Then, your program should be able to guess the number by asking the user no more than 10 yes/no questions. Use a while loop in your program
What is a hashmap c++?
Is C++ case sensitive a) False b) Depends on implementation c) True