I am trying to initialize a char array like this :
.. but it doesn't seem to work ( I checked the array values in the debugger window).Code:char myArray[10][10] = {'V'};
Am i doing something wrong?
Thank you.
I am trying to initialize a char array like this :
.. but it doesn't seem to work ( I checked the array values in the debugger window).Code:char myArray[10][10] = {'V'};
Am i doing something wrong?
Thank you.
Last edited by skiabox; 11-01-2010 at 04:45 AM.
In fact I want to fill all the array with the same character.
I've read in a book that this is the way to do it (see my previous post) but it doesn't seem to work.
It only works for a one-dimensional array if the initial value is zero - because the elements that are not explicitly initialised are initialised to zero.
To do what you want (set all characters in the 2D array to 'V') you need to use a loop that assigns the elements individually. Or, possibly, use memset().
Thank you all for your help!