C Program to Demonstrate Printf inside Another Printf Statement


Printf inside printf in C : Example 1

Output :


How ?

  1. Firstly Inner printf is executed which results in printing 1324 
  2. This Printf Returns total number of Digits i.e  4 and second inner printf will looks like
  3. It prints 4 and Returns the total number of digits i.e 1 (4 is single digit number )
  4. It prints simply 1 and output will looks like 132441

Rule :
Inner printf returns Length of string printed on screen to the outer printf