What is the Difference between "printf" and "sprintf"?

Answer Posted / 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.

printf("%s",google);
char *p;
sprintf(p,"%s",google);

Is This Answer Correct ?    91 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the various operations performed on stack?

708


what is C++ exceptional handling?

712


What are the advantages of using pointers in a program?

759


What does std :: flush do?

783


What are the advantages of using friend classes?

723






Out of fgets() and gets() which function is safe to use?

746


Describe linkages and types of linkages?

663


What is the difference between map and hashmap in c++?

663


What is a pointer how and when is it used?

676


What ANSI C++ function clears the screen a) clrscr() b) clear() c) Its not defined by the ANSI C++ standard

690


What is the difference between public and private data members?

755


How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?

738


What is enum c++?

725


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

669


What is the latest c++ version?

706