What is the purpose of sprintf() function?

C Programming Language >   File Input/Output >   File Operation in c  

Long Question

1203


Answer:

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


int sprintf ( char * str, const char * format, ... );  

Let's see a simple example

 #include<stdio.h>  
int main()  
{  
 char a[20];  
 int n=sprintf(a,"javaToint");  
 printf("value of n is %d",n);  
 return 0;
}  

Output:
value of n is 9


This Particular section is dedicated to Question & Answer only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.