473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

return type of printf in c

sanjay123456
125 100+
Dear Friends ,

plz tell me that what is the return type of printf() and scanff in C
means what they return ?
sanjay
Feb 1 '07 #1
3 5063
hirak1984
316 100+
it returns int.Look at this.http://www-ccs.ucsd.edu/c/stdio.html




Dear Friends ,

plz tell me that what is the return type of printf() and scanff in C
means what they return ?
sanjay
Feb 1 '07 #2
horace1
1,510 Expert 1GB
Dear Friends ,

plz tell me that what is the return type of printf() and scanff in C
means what they return ?
sanjay
scanf returns as an int function result the number of successful conversions or EOF on input failure
you can use this see if the scanf() worked, e.g.
Expand|Select|Wrap|Line Numbers
  1.     int a;
  2.     float b;
  3.     if((scanf("%d%f", &a, &b)) != 2)
  4.       printf("input failed\n");
  5.  
if the scanf() result is not 2 the read of a and b failed

in the case of print the int function result is
On success, the total number of characters written is returned.
On failure a negative number is returned.
Feb 1 '07 #3
hirak1984
316 100+
Ya, horace described it in best possible way.



scanf returns as an int function result the number of successful conversions or EOF on input failure
you can use this see if the scanf() worked, e.g.
Expand|Select|Wrap|Line Numbers
  1. int a;
  2. float b;
  3. if((scanf("%d%f", &a, &b)) != 2)
  4. printf("input failed\n");
  5.  
if the scanf() result is not 2 the read of a and b failed

in the case of print the int function result is
On success, the total number of characters written is returned.
On failure a negative number is returned.
Feb 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Nuno Barros | last post by:
Hello, I am writting a c++ code to crete a kind of a table in memory. Each table has an container of columns, which can be of any type. To do this i created a virtual class Column which has...
5
by: starket | last post by:
Hi folks, I'm new to programming, please help, char * b, q, *r; b=getbuf(); q = *b; r= anotherfunction(b); /* we want to use ‘q' and ‘r' here*/ char * getbuf() {
59
by: Michael C | last post by:
eg void DoIt() { int i = FromString("1"); double d = FromString("1.1"); } int FromString(string SomeValue) {
3
by: C++ | last post by:
According to Thinking in C++ "You cannot modify the return type of a virtual function during overriding.but there is a special case in which you can slightly modify the return type. If you¡¯re...
17
by: benben | last post by:
Given a class template Vector<>, I would like to overload operator +. But I have a hard time deciding whether the return type should be Vector<U> or Vector<V>, as in: template <typename U,...
8
by: WakeBdr | last post by:
I'm writing a class that will query a database for some data and return the result to the caller. I need to be able to return the result of the query in several different ways: list, xml,...
9
by: hufaunder | last post by:
I have a class "TestSuper" that implements the interface "TestBase". The interface has a property of type "ReturnType". The class "TestSuper" does not return "ReturnType" but a derivation...
6
by: Andrus | last post by:
I need to create method which returns my application object type as string : TypeName(typeof( List<int>)) should return "List<int>" or "System.Collections.Generic.List<int>" ...
0
by: Vikram Patro | last post by:
I'm trying to return the values of this function to the place where it's being called from. What would be the return type of the function neighborSet. called function is Graph::neighborSet...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.