I thought I was comfortable with using for loop since it's pretty simple and now I came across this problem and I see nothing wrong with it but the error kept on insisting I have not declared my counter when I did. This is my code:
Code:
//Declare data type and variables for the users input
double x_coord[4]; //variable for x coordinates
double y_coord[4]; //variable for y coordinates
double best_location_x, best_location_y, total_x, total_y; //variable for the centroid\
int i; //use for counter
//Use for loop to get the coordinates of each x and y coordinates in an array set
for (i = 1; i < 4; i++){
//Get users input on first location
printf("What are the x-y coordinates of location %d (values in miles between -50 and 50): ", i);
//Store the users input
scanf("%lf%lf", &x_coord[i], &y_coord[i]);
} //end for loop
The error says in the line for(i = 1; i<4; i++) 'i' is undeclared (first use in this function)
I declared i in int = i; so I have no idea why it's not running.
I appreciate it if anyone could lend a hand
A hint would be lovely ^.^