我收到此错误:
str.c:5:19: error: expected identifier or '(' before 'struct'
编译以下代码时。它有什么问题?
#include <stdio.h>
struct addpoints (struct point p1, struct point p2){
p1.x += p2.x;
p1.y += p2.y;
return p1;
}
int main(){
struct point{
int x;
int y;
};
struct point p1 = { 13, 22 };
struct point p2 = { 10, 10 };
addpoints (p1,p2);
printf("%d\n", p1.x);
}