使用gcc 9.1.0在linux平台编译如下:
function.c: 在函数‘fun1’中: function.c:9:29: 错误:一元 ‘*’参数类型无效(有‘int’) 9 | void fun1(int x, int y){x = *y;} | ^~ function.c: 在函数‘fun4’中: function.c:12:25: 错误:一元 ‘*’参数类型无效(有‘int’) 12 | void fun4(int x, int y){*x = *y;} | ^~ function.c:12:30: 错误:一元 ‘*’参数类型无效(有‘int’) 12 | void fun4(int x, int y){*x = *y;} | ^~
所以答案当然是A,D了!
int * fun(int *x, int y){return x += y;}