You need to use size
instead of fmt
:
va_start(args, size);
It is size
, not fmt
, that is the last parameter that has an explicit name (as opposed to vararg parameters, which have no names). You need to pass the last named parameter to va_start
in order for it to figure out the address in memory at which the vararg parameters start.