Writing to a 2D array
Hi, I'm slightly stuck. I have got the user to input a value which is then stored at a hard coded index within the 2D array.
After all the input values have been entered, the system applies the requested logic to the values. This results in a single interger output.
printf("Enter the 1st input value: ");
Now, this is where I'm stuck, is there a way of writing that value to an index location in the 2D array that the user specifies.
ie, where would you like store the value? Then user inputs the row and column index number. Usig scanf() this becomes the location of the value.
Any help would be great, thanks
You probably need to store the value in a temporary variable - unless you know the position, in which case you can of course use the same style of code you already have, but using the index the user provided [after you have validated that it's a valid position of course and not outside of the 2D array].
Unless I'm misinterpreting the question.
int x, y;
printf("Enter row: ");
printf("Enter column: ");
my2darray[x][y] = myvalue;
Fixed, thankyou for your help