// Week 4 Lecture 1 example // Using arrays of structs #include #define MAP_SIZE 5 struct coordinate { int x; int y; }; void read_map(int size, struct coordinate map[size]); void print_map(int size, struct coordinate map[size]); // Translate function int main(void) { struct coordinate map[MAP_SIZE]; read_map(MAP_SIZE, map); print_map(MAP_SIZE, map); return 0; } void read_map(int size, struct coordinate map[size]){ int i = 0; while (i < MAP_SIZE) { printf("Enter a point: "); scanf("%d %d", &map[i].x, &map[i].y); i++; } } void print_map(int size, struct coordinate map[size]){ int i = 0; while (i < MAP_SIZE) { printf("(%d, %d) ", map[i].x, map[i].y); i++; } printf("\n"); }