What do printf and scanf return
There are several situations where we need certain part of code not to be executed at run-time so we comment them out. This means that code no longer execute as part of C Program. A good programmer always recognized by how one can document code so that programs become more readable and structured. The use of good commenting style help to save lot of time in long run. Especially for others who would want to review your code and contribute to your work.
Here is example code:. Now we know how input and output works. At first, it may seems to be an advance level trick but in fact, you can modify your functions as well to accept variable number of arguments. The answer is vararg. We demonstrate this by an average function that will accept any number of arguments.
Example of using Vararg for average function is as follows:. But its outputting " 5". Derek 1, 13 13 silver badges 33 33 bronze badges. Angus Angus Where is the space you say it should print, in the posted code? In my system it prints , with no spaces, as expected. Err, "" is four characters, not one. Add a comment. Active Oldest Votes. Mat Mat k 39 39 gold badges silver badges bronze badges. The outer call then happens, and prints the 5 that was returned by the inner call.
RichieHindle RichieHindle k 45 45 gold badges silver badges bronze badges. EdChum k gold badges silver badges bronze badges. Ranjit Pasale Ranjit Pasale 51 1 1 silver badge 1 1 bronze badge.
Shawn Chin Qchmqs Qchmqs 1, 2 2 gold badges 19 19 silver badges 29 29 bronze badges. Why is it so? Profile Answers by Nikhil Saini. Printf return no of char read.. Return type of both of them is integer. Scanf returns how many things it has read while printf returns how many characters get printed. Please Turn OFF your ad blocker.
Learn More.
0コメント