-
Static array
Code:
void array(int x, int y)
{
a[x][y] = 'A';
}
I have a[][] delcared as a static char array in main, and this function is called from another one with parametrs inputed by the user. I want to put the letter A, at the position provided by x an y, however, it says x and y are never used in fucntion array.
Why is this occuring?
Thanks
-
>> I have a[][] delcared as a static char array in main
Because you can't access main's local variables.
-
Where should I declare the static array then?
Before main?
-
I declared it outside of main, and its working, but is that assignment I made with a[x][y] = 'A' correct?
Thanks
Its either Im not printing the array correctly, or that assignment statment is wrong.
-
Yea the statement is correct. You may want to check the size of x and y to make sure it's valid.