Learn Programming C | C++ | Java | Android | Tips and Tricks

Nested Printf statements : Example 2


nested Printf statements : Example 1


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("%d",printf("abcdefghijklmnopqrstuvwxyz"));
getch();
}

Output :

abcdefghijklmnopqrstuvwxyz26

How ?

  1. “abcdefghijklmnopqrstuvwxyz” will be first Printed while executing inner printf
  2. Total Length of the “abcdefghijklmnopqrstuvwxyz” is 26
  3. So printf will return total length of string
  4. It returns 26 to outer printf
  5. This outer printf will print 26

About The Author

My name is Pritesh Taral. I am working in well known MNC. as Java Developer. I am part time blogger loves writing articles on C/C++. I am active on facebook using community fan page .One can Visit me @ Facebook Facebook Fan Page

  • Lakshmisowmya 578

    i=43
    printf(“%d”,printf(“%d”,printf(“%d”,i)));
    what will be the o/p for the above stmt