Geeks Talk

Prepare for your Next Interview




Return Value of Functions

This is a discussion on Return Value of Functions within the C and C++ forums, part of the Software Development category; All functions return some value. Does it mean that even printf and scanf which are functions in C return some value? If so what is the value returned by these ...


Go Back   Geeks Talk > Software Development > C and C++

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-12-2006
Contributing Member
 
Join Date: May 2006
Posts: 66
Thanks: 1
Thanked 5 Times in 4 Posts
janelyn is on a distinguished road
Return Value of Functions

All functions return some value. Does it mean that even printf and scanf which are functions in C return some value? If so what is the value returned by these functions.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-12-2006
Contributing Member
 
Join Date: May 2006
Posts: 84
Thanks: 0
Thanked 9 Times in 6 Posts
timmy is on a distinguished road
Re: Return Value of Functions

Yes. As all functions return value so are these functions. I am not aware about scanf but printf returns the number of characters printed by the printf function. Hope we get to know about the return value of more functions in this discussion.
Reply With Quote
  #3 (permalink)  
Old 09-19-2007
Junior Member
 
Join Date: Aug 2007
Location: Bangalore
Posts: 15
Thanks: 0
Thanked 4 Times in 3 Posts
n.ashis is on a distinguished road
Re: Return Value of Functions

printf returns the number of characters that it prints, whereas scanf returns the number of format specifiers being passed to it in the format string.

Correct me if i am wrong...
Reply With Quote
  #4 (permalink)  
Old 09-24-2007
Junior Member
 
Join Date: Sep 2007
Location: Bangalore
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Amit Mittal is on a distinguished road
Re: Return Value of Functions

Quote:
Originally Posted by janelyn View Post
All functions return some value. Does it mean that even printf and scanf which are functions in C return some value? If so what is the value returned by these functions.
ya printf and scanf also return values.
print return no of character printed successfully or negetive value if an error occured.
scanf return no of argument that are inputed or read .
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Query to See Functions joel SQL 3 02-23-2007 06:33 AM
Adding functions to function generator bvani WinRunner 2 12-20-2006 04:56 AM


All times are GMT -4. The time now is 01:22 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved