结构做为函数参数且有默认值函数声明怎么写?
vc++编译器 6.0
typedef struct
{
int test1;
int test2;
int test3;
int test4;
} teststuct;
teststuct dd ={0,0,0,0};
void test(int i,teststuct ddd = {0,0,0,0})
{
}
本人的目的想用teststuct 做为 void test(int i,teststuct ddd = {0,0,0,0})的数,而且想要一个默认参数,但是这么写有问题,不知道为什么?
应该怎么写?不知道可有高手指点一下。
main()
{
test(1);
return ;
}
vc++编译器 6.0
typedef struct
{
int test1;
int test2;
int test3;
int test4;
} teststuct;
teststuct dd ={0,0,0,0};
void test(int i,teststuct ddd = {0,0,0,0})
{
}
本人的目的想用teststuct 做为 void test(int i,teststuct ddd = {0,0,0,0})的数,而且想要一个默认参数,但是这么写有问题,不知道为什么?
应该怎么写?不知道可有高手指点一下。
main()
{
test(1);
return ;
}
{
teststuct(int t1, int t2):test1(t1),test2(t2){}
int test1;
int test2;
};void test(teststuct ddd = teststuct(0,0})
{
}