initialization of char array (c style string)
hey how would you initialize all the elements of a char array in the array declaration to a specific character ?
like
Code:
int array[MAX] = {0};
initializes all the elements to zero
i want a char array to initialize all of its element to ' '
my try was
Code:
char array[MAX] = { ' ' }
but the array has the first element to ' ' all else to null why ?
BTW i want it to be done in the array declaration, i know i can ran the array through a loop and initialize but im thinking that there might be another way