#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
void tag_log(const char *format, ...) {
va_list ap;
va_start(ap, format);
for (int i = 0; i < 4; i++) {
va_arg(ap, int) += 100; // is wrong?
}
va_end(ap);
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
}
int main() {
tag_log("%d, %d, %d, %d\n", 1, 2, 3, 4);
}
va_arg(ap, int) = 100; \/\/ is wrong?<\/code>
<\/blockquote>
Yes, it's wrong.
va_arg<\/code> returns an rvalue (which isn't assignable).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.