可变个数参数的用法谢谢
我想知道 把fun() 的 后面几个参数用上的办法,谢谢#include <iostream>
using namespace std;
void fun(int a, ...){
int *temp = &a;
temp++;
for (int i = 0; i < a; ++i) {
cout <<"i=="<<i<<"\t"<<"a=="<<a<< "\ttemp point to "<< *temp <<endl;
temp++;
}
}
int main(){
fun(8, 9, 7, 2, 5);
return 0;
}
https://fishc.com.cn/forum.php?mod=viewthread&tid=198037
页:
[1]