Points with a struct · Puntos con una estructura
Points with a struct
A struct groups related values into one type. Here struct Point holds an x and a y. Complete two functions: make_point builds and returns a Point, and move_point shifts an existing one. With a pointer to a struct you reach its fields with ->, so p->x += dx moves it.
Puntos con una estructura
Un struct agrupa valores relacionados en un solo tipo. Aquí, el struct Point contiene un x y un y. Complete dos funciones: make_point construye y devuelve un Punto, y move_point desplaza uno existente. Con un puntero a una estructura, se accede a sus campos mediante ->, por lo que p->x += dx lo mueve.
A struct Point with int x, y is given. Complete make_point(int x, int y) to build a Point, and move_point(struct Point *p, int dx, int dy) to shift it by (dx, dy) using ->. · Se da una struct Point con int x, y. Completa make_point(int x, int y) para construir un Point, y move_point(struct Point *p, int dx, int dy) para desplazarlo por (dx, dy) usando ->.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.