Printf and scanf return values :
scanf retuns no of inputs taken according to format specifier.
e.g. :
int a,b,c;
c=scanf(“%d%d”,&a,&b);
Explanation :
if a=100 and b=200 then returned value to c will be 2. or if you give input value as character than correspondingĀ input count will be added as zero. if you give a as input character ‘d’ and and b as input 200 then returned value to c will be 1.
printf returns no of characters printed on screen.
c=printf(“Coding Street”);
Then value of c will be 13.
c=printf(“%d %d”,a,b);
if a=200 and b=300 then printed value on screen is ‘200 300’ so assigned value to c will be 7.