C Program to Demonstrate Nested Printf Statements
nested Printf statements : Example 1
1 2 3 4 5 6 7 8 | #include<stdio.h> #include<conio.h> void main() { clrscr(); printf("%d", printf("abcdefghijklmnopqrstuvwxyz")); getch(); } |
Output :
1 | abcdefghijklmnopqrstuvwxyz26 |
How ?
- “abcdefghijklmnopqrstuvwxyz” will be first Printed while executing inner printf
- Total Length of the “abcdefghijklmnopqrstuvwxyz” is 26
- So printf will return total length of string
- It returns 26 to outer printf
- This outer printf will print 26