I need to initialize an array of structs with the same default values. This is a VERY large array, so setting each element by hand in an initializer is not feasable. Is the following code a correct and sane way to do this, or will I need to fall back on some initializer function and a for loop?
#define SIZE_OF_S1_ARR 10000 //just some arbitrary size for an example
typedef struct { char* id, char* description} S1;
/*
* Array of structs, with each element having an id and a description
* which is an empty c-string
/*/
S1 s1_arr[SIZE_OF_S1_ARR] = {{ "", "" }};
I will add that this array already existed as a char array which only contained the ids as a single character. I am replacing it with the more useful struct.
NULLis found?S1 s1_arr[SIZE_OF_S1_ARR] = {0};