+ 1
What is return printf() and scanf() function
7 ответов
+ 3
Your question is a bit unclear, do you want to know about return, printf, and scanf? Or do you want to know the return values of prinf and scanf functions? In case it is the later, printf returns the number of characters it prints. scanf returns the number of items it has successfully read.
int x, y;
printf("%d\n", printf("abc\n"));
printf("%d", scanf("%d%d", &x, &y));
Output is
abc
4
2
+ 3
You never said the word "type", and if you know the values, you know their types: integer for both.
+ 2
printf() is an library function used to print the input stream
scanf() is used fir user input from keyboard or keypad
int x;
scanf("%d",&x);
printf("%d",x);
+ 1
I have ask return type not value that will print or scan
+ 1
Yes they both return integer but integer value= number of parameters it passed
+ 1
I'm still confused; I did explain what they return in my first comment. Do you still have any questions then?
0
Do you mean for what purpose the return value could be meaningfully used?
Well, if it works properly, you could take input in a loop and only break that loop when the values are all read in properly, something like that.
(scanf seems to be bit troublesome, there are a lot of homepages discussing the difficult points.)