About C function

from printf

Return value

Upon successful return, these functions return the number of
characters printed (excluding the null byte used to end output to
strings).

in your example your printf prints 135 and a ‘\n' thus giving 4

try different variations and see

float w=printf("%d\n",add(40,40,55));
printf("%f\n",w);

 w=printf("%d\n",add(40,0,5));
printf("%f\n",w);

 w=printf("%d\n",add(0,0,5));
printf("%f\n",w);

on a completely different note w should have been an int

Leave a Comment