In Case of printf- filled with the number of total characters printed at that point in the printf...
And in case of scanf -new line from previous input is being considered for consecutive scanfs
For eg:
#include < stdio.h >
int main()
{
int temp = 0;
int x = -1;
printf("Testing %n\n", &temp);
//It will store the no of char got printed i.e Testing + one space char total 8 to "temp"
scanf("%d%n", &temp,&x); //Here not a single char is given .. to it store 0 to x
printf("x = %d\n", x);
scanf("%d%n", &temp, &x); // Here it will wait for user to give input and store its no of digit to x.
printf("x = %d\n", x);
scanf("%d%n", &temp,&x); //Here not a single char is given .. to it store 0 to x
printf("x = %d\n", x);
return 0;
}
o/p:
Testing
12
x = 2
123
x = 4
1234
x = 5