为什么全局函数调用结构体变量参数时报出这三个错误
Compiling source file(s)...Sizeof.cpp
Sizeof.cpp:19: error: expected unqualified-id before "return"
Sizeof.cpp:19: error: expected `,' or `;' before "return"
Sizeof.cpp:19: error: expected declaration before '}' token
Sizeof.exe - 3 error(s), 0 warning(s)
源代码如下:(cpp文件独立运行,无头文件)
#include <iostream>
using namespace std;
struct A{
int i;
};
void func1(A *a,int j);
void func2(A *a);
int main(){
A *a ;
int j = 5;
func1(a,j);
func2(a);
return 0;
}
return 0;}
void func1(A *a,int j){
a->i = j;
cout<<"A->i ="<<a->i<<endl;
}
void func2(A *a){
cout<<"A->i ="<<a->i<<endl;
}