出自https://wangdoc.com/clang/function最近再看C语言,由于非科班出身,只有一丢丢VB印象(早已忘光),没学C语言总觉得有一点点遗憾。填坑。k可变参数 ,一个函数有不确定个函数时可用。func(int i, ...){}参数 ... 便是可变参数位置。定义含有可变参数函数时,需要先引入 #include <stdarg.h> 其中有几个函数,va_list, va_start, va_arg, va_endva_list: 一个数据类型,用来定义一个可变参数对象。它必须在操作可变参数时,首先使用。va_start: 来确定可变函数位置,他接受两个参数。一个是用来初始化的可变参数对象。第二个参数是原始函数里面可变参数的那个参数,用来为可变参数定位。va_arg: 一个函数,用来取出当前那个可变参数,每次调用后,内部指针会指向下一个参数。第一个可变参数对象,第二个是当前可变参数类型。va_end: 一个函数,用来清理可变参数对象。/* Online C Compiler and Editor */ #include <stdio.h>
风里来
最后,我终于解放了我自己……