#include <stdio.h>
typedef struct point{
int xpos;
int ypos;
}Point;
void ShowPoint(Point p1, Point p2)
{
printf("pos1: [%d, %d] \n", p1.xpos, p1.ypos);
printf("pos2: [%d, %d] \n", p2.xpos, p2.ypos);
}
Point SwapPoint(Point *p1, Point *p2)
{
Point temp = *p1;
*p1 = *p2;
*p2 = temp;
}
int main(void)
{
Point pos1={2, 4};
Point pos2={5, 7};
SwapPoint (&pos1, &pos2);
ShowPoint(pos1, pos2);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: