I want an array in a struct but I am unsure how to do it. I can only use one array in the struct.
typedef struct
{
int arr[10];
} coords;
coords x;
printf("Enter X coordinates: ");
scanf("%d", x.arr[0]);
scanf("%d", x.arr[1]);
scanf("%d", x.arr[2]);
...
My problem is how do I also enter the X values in the array? I was first thinking of a two dimensional array arr[10][10] but it wouldn't work because I have some calculations to do on the X values.
Is the proper way just do define a new object like coords x; and just do it all over?
Basically I want the struct to contain one (1) array. I want the struct to contain x and y coordinates for a map, which the user inputs. Later in the program I want to do calculations with ONLY the x values.