下面的代码怎么了?如何使函数print()作为printf工作?
#include <stdio.h>
#include<stdarg.h>
void print(char *format,...)
{
va_list args;
va_start(args,format);
printf(format,args);
}
int main() {
print("%d %s",5,"le");
}
最佳答案
你需要打印。看看这个问题,它有一个类似的问题:what's the difference between the printf and vprintf function families, and when should I use one over the other?
关于c - 模仿printf,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10688522/