sprintf() in c

Declaration

Following is the declaration for sprintf() function.

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

Example

The following example shows the usage of sprintf() function.

#include <stdio.h>
#include <math.h>

int main()
{
   char str[80];

   sprintf(str, "Value of Pi = %f", M_PI);
   puts(str);
  
   return(0);
}

posted @ 2013-08-23 23:27  dorothychai  阅读(161)  评论(0编辑  收藏  举报