_KATANA_
2019-09-23 11:33C++中构造一个函数放在main方法后面,再在main方法中调用为什么会报错
#include
#include
struct Contact
{
char name[16];
int id;
int score;
};
int main()
{
Contact a={"lishunxin",29,100};
Test(a);
return 0;
}
void Test(Contact a)
{
printf("name:%s\t,id:%d\t,score:%d\t",a.name,a.id,a.score);
}
- 点赞
- 回答
- 收藏
- 复制链接分享
3条回答
为你推荐
- 为什么Point类的无参数构造函数无法调用?还有根据题意我应该在CRect的构造函数里面写些什么?有没有一种可能能在CRect的构造函数中调用CRect的成员函数?
- c语言
- c++
- 1个回答
- 创建一个类Student。然后在main函数中创建一个对象(“12345”,“张三”,“男”),并调用相应的方法完成数据的输入和输出,使用string类型存储字符串数据。
- c++
- 1个回答
- C++ 为什么会调用拷贝构造函数而不是拷贝赋值运算符?
- 中文分词
- 搜索引擎
- 全文检索
- c++
- 百度
- 2个回答
- 求助:如何在Dev-cpp中使用SetPixel函数?
- c++
- 1个回答
- 关于C++类调用有参构造函数的问题
- c++
- 1个回答
换一换