Pages

Thursday 2 October 2014

Return value of printf() function in C

Return value of printf() function in C


Ans:
A function always returns a value and printf function returns the number of characters successfully printed.


main() 
{ 
int s=1; 
printf("%d",printf("%d %d %d", s,s,s)); 
}
In this above program the inner printf is first called which prints value of s, three times with space between each value, 1 1 1.
Total 5 characters get printed = 3 values and 2 spaces).
As explained earlier the inner printf after printing the values, returns the number of characters printed, 5 which is printed by the outer printf.
The output of the above program is
1 1 1 5


RUNNING ANT BUILD.XML GETTING: JAVA VIRTUAL MACHINE LAUNCHER: COULD NOT FIND THE MAIN CLASS. PROGRAM WILL EXIT



sol:
1) Is the path to java bin directory set properly?? (To check this you need to write command javac in command prompt(cmd) and you will get a list of instructions on cmd console)

 how to set properly bin &pathsetup click here step by step