Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the Difference between "printf" and "sprintf"?

Answer Posted / prits

printf : Print formatted data to stdout (function)
sprintf:writes its results to a string instead of stdout

#include <stdio.h>

int main ()
{
char buffer [50];
int n, a=5, b=3;
n=sprintf (buffer, "%d plus %d is %d", a, b, a+b);
printf ("[%s] is a %d char long string\n",buffer,n);
return 0;
}

Is This Answer Correct ?    31 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you please explain the difference between static and dynamic binding of functions?

968


Why is c++ difficult?

988


How do you remove an element from a set in c++?

1027


What is the difference between new() and malloc()?

1919


Is oops and c++ same?

994


How do pointers work?

1126


what is pre-processor in C++?

1084


Can a program run without main in c++?

1121


What's c++ used for?

1050


How is data hiding achieved in c++?

1022


What are structs in c++?

967


If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?

989


Comment on assignment operator in c++.

1069


What is c++ vb?

1027


List different attributes in C++?

1013