Tags : Nested Printf | nesting of Printf | Printf within Printf having Blank Spaces
What is the return value from printf() function?
#include<stdio.h>void main(){ int a=20; printf("%d",printf("%d %d %d", a,a,a));}
Output :
20 20 208
Why ?
- Rules : Always Innermost Printf will be executed First .
- Printf function returns the number of characters printed.
- In the Above Example of Nested Printf , Inner Printf Prints [20 20 20] , here number of Characters Printed On Screen = 8 Including two Blank Spaces .
printf("%d",8);- Outer Printf will Print “8″