正如我们所知的printf()
函数,它可以保存字符,如果需要的话可以有额外的参数。前任。 printf("程序员");
printf("程序员 %d",14);
如何在原型(prototype)函数中添加其他参数?
是类似 some_func(char *str, ...)
吗?
最佳答案
为了在 C 中使用可变数量的参数,您需要包含以下库
#include <stdarg.h>
C 中的 printf()
是采用可变数量参数的函数示例。
int printf(const char *fmt, ...)
更多信息here
关于在 C 中创建带有附加参数的原型(prototype)函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20989920/