Features :
- Output is Written into String instead of Displaying it on the Output Devices .
- Return value is integer ( i.e Number of characters actually placed in array / length of string )
- String is terminated by '\0'
- Main Per pose : Sending Formatted output to String
- Header File : Stdio.h
Live Example :int sprintf(char *buf,char format,arg_list);
Output of Above Program :int age = 23 ; char str[100]; sprintf( str , "My age is %d",age); puts(str);
Analysis of Source Code : - Just keep in mind thatMy age is 23
- Assume that we are using printf then we get output "My age is 23"
- What does printf does ? ----- Just Print the Result on the Screen
- Similarly Sprintf stores result "My age is 23" into string str instead of printing it.
0 Comments:
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email