GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 46 of 255    Print  
Difference between "printf" and "sprintf".

  
Total Answers and Comments: 1 Last Update: January 09, 2007   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 09, 2007 01:19:16   #1  
vmshenoy Member Since: October 2005   Contribution: 508    

RE: Difference between "printf" and "sprintf".
    printf is the standart function in (c) programming language library for printing  formatted output.


eg

printf writes the resulting string to the standard output(remember, Awk has only one output file).

So, for example:

printf("%sn","jellotHarold!")

prints the string "Jello<tab>Harold!" to the standard output,followed by a newline.  Note that there's a tab character inthe middle.

Similarly,

X=sprintf("%sn","jellotHarold!")

assigns the string 'Jellow<tab>Harold!" to the variable X.


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : it will give last initialize value..suppose you write ..int x=10;printf("%d");then it prints 10;if not initialize then print a garbage value.. ...

Latest Answer : The basic difference in C and C++ structures is :1) In C , default access for structure members is public2) In C++ , defaulot access for structres is private ...

Latest Answer : overloading is mainly for operators and overriding is for functions ...

Latest Answer : Arrays have to difine with fixed size it will not grow dynamically , vector size can be increased bydynamically and vectors are synchronized.yaa always right.vector is a standard template library in C++. Vector size can be increased dynamically and stores ...

Latest Answer : Calloc:- #include void *calloc(size_t nelem, size_t elsize);The calloc() function allocates space for an array of nelem elements of size elsize. The space is initialized to zero. Malloc:#include void *malloc(size_t size);The malloc() function allocates ...

Latest Answer : The return type of the printf() function is 'int'. (lot of confusion surrounding the return type of printf -- correct answer is 'int')  ...

Latest Answer :     printf is the standart function in (c) programming language library for printing  formatted output.egprintf writes the resulting string to the standard output(remember, Awk has only one output file).So, for example: printf("%sn","jellotHarold!")prints ...

Latest Answer : Both aggregation and composition are special kinds of associations. Aggregation is used to represent ownership or a whole/part relationship, and composition is used to represent an even stronger form of ownership. With composition, we get coincident lifetime ...

Latest Answer : Sequence diagrams describe interactions among classes in terms of an exchange of messages over time. Collaboration diagrams represent interactions between objects as a series of sequenced messages. Collaboration diagrams describe both the static structure ...

Latest Answer : uses and includes are the different avatars of the same concept. uses represents a concept in which one usecases uses the other. So when you invoke the former the latter is always invoked. Extends adds additional functionality, it is used when one ...


 Sponsored Links

 
Related Articles

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960&rsquo; s The term object oriented programming&rsquo; was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

printf() Function Return Value

What is the return value from printf() function? printf function always returns the number of characters printed. Let us understand this with an example: main() { int a=10; printf(&quot;%d&quot;,printf(&quot;%d %d %d&quot;, a,a,a)); } In this above program the inner printf i
 

What are the Format Specifiers used with printf?

There are several format specifiers available in printf. The format specifier used varies depending on the data type used for printing. The given below are some of the format specifiers used with printf in C program. For integer data type the format specifier used with printf is %d or %i For float
 

printf and sprintf

What is the difference between printf and sprintf? sprintf: Writes formatted data to a character string in memory instead of stdout Syntax of sprintf is: #include &lt;stdio.h&gt; int sprintf (char *string, const char *format [,item [,item]...]); Here, String refers to the pointer to a
 

The Inheritance Concept In OOPs

The Inheritance Concept In OOPs In object oriented programming objects will be characterised by classes It is possible to learn a lot about an object based on the class it belongs to Even if you are not familiar with the name Maybach If I told you it is a car you would immediately know that it has f
 

Understanding The Message Concept In OOPs

Understanding The Message Concept In OOPs To understand object oriented programming you will need to become familiar with messages As the name implies a message is a process in which software objects will communicate with one another Because of this having one object is not enough mosgoogle An objec
 

Basic concepts of OOPS and Structure of C++ program

Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape