通过函数实现结构体变量的值的改变
#include <stdio.h>struct yys
{
int x;
int y;
};
struct yys getstruct(void);
void outputstruct(struct yys);
int main(void)
{
struct yys num = {3,5};
num = getstruct();
outputstruct(num);
}
struct yys getstruct(void)
{
struct yys p;
scanf("%d,%d",&p.x,&p.y);
printf("%d,%d\n",p.x,p.y);
return p;
}
void outputstruct(struct yys pp)
{
printf("%d,%d\n",pp.x,pp.y);
}
页:
[1]