Commit da02d6e8 authored by 야오지앙's avatar 야오지앙

Upload New File

parent b5e2cdb3
#pragma warning(disable:4996)
#include<stdio.h>
#include<windows.h>
#include<string.h>
struct point {
int xpos;
int ypos;
}Point;
struct point* getStruct(struct point*);
void output(struct point);
void print(const struct point* p);
int main()
{
struct point y = { 2,4 };
getStruct(&y);
output(y);
output(*getStruct(&y));
*getStruct(&y) = (struct point){ 1,2 };
}
struct point* getStruct(struct point* p)
{
scanf("%d", &p->xpos);
scanf("%d", &p->ypos);
printf("%d,%d\n", p->xpos, p->ypos);
return p;
}
void output(struct point p) {
printf("%d,%d\n", p.xpos, p.ypos);
}
void print(const struct point* p)
{
print("%d,%d", p->xpos, p->ypos);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment