Explanatory Question
What is the purpose of sprintf() function?
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.
The sprintf() stands for "string print." The sprintf() function does not print the output on the console screen. It transfers the data to the buffer. It returns the total number of characters present in the string.
Syntax
Let's see a simple exampleint sprintf ( char * str, const char * format, ... );
Output:#include int main() { char a[20]; int n=sprintf(a,"javaToint"); printf("value of n is %d",n); return 0; }
value of n is 9
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.