What type is row_zero?
I'll assume it is double* (like col_zero).
The compiler will automatically convert function arguments to the types specified by the in-scope function prototype or function definition before passing the arguments to that function. When argument type information is not available (no function declaration, old-style function declaration/definition,
variable number of arguments), the compiler performs the so-called
usual conversions on arguments before passing them to that function. I listed my recollection of the usual conversions below. This may not be precisely correct, but it will give you the idea.
- float or double arguments are converted to double;
- char, unsigned char, short, unsigned short, and int are converted to int;
- unsigned int is converted to unsigned int;
- long is converted to long;
- unsigned long is converted to unsigned long.
The function prototype for fprintf is
- int fprintf(FILE *fp, const char *fmt, ...);
The first two arguments are converted to the prototyped types, but the last two arguments are subject to the usual conversions. The third argument is converted to double, the last is converted to int. The format string tells fprintf to interpret the third argument as an integer, but it is actually a double so you have undefined behavior -- anything can happen. The format string tells fprintf to interpret the last argument as an int, and it is an int so that one is handled properly.