+ 1

What is the difference between printf and sprintf ?

15th Dec 2016, 11:11 AM
Ravi D
Ravi D - avatar
2 Antworten
+ 2
Hey Ravi , printf : output to the standard output stream (stdout ) sprintf: goes to a buffer you allocated (char *) printf : printf ("format", args) is used to print the data onto the standard output which often a computer monitor. sprintf: sprintf(char*, "format", args) is like printf. instead on displaying the formated string on the standard output i.e. a monitor, it stores the formated data in a string pointed to by the char pointer . the string location is the only difference between printf and sprintf syntax. example for sprintf char *p ; sprintf (p," %s", Mock); Hope I answered your question .
15th Dec 2016, 11:50 AM
Mock
Mock - avatar
0
Got it but not fully... Can u explain it in easy language... It is to much technical...
15th Dec 2016, 1:14 PM
Ravi D
Ravi D - avatar