当我在fill函数中打包结构并传递指针以发送如何取消引用它时,如何取消引用指针?因为我在我所做的事情中得到了分段错误
#include<stdio.h>
struct xxx
{
int x;
int y;
};
void fill(struct xxx *create)
{
create->x = 10;
create->y = 20;
send(*create);
}
main()
{
struct xxx create;
fill(&create);
}
send(struct xxx *ptr)
{
printf("%d\n",ptr->x);
printf("%d\n", ptr->y);
}
Run Code Online (Sandbox Code Playgroud)