I’ve got about 12000 pre known values that I need to place in an array early in the program. Given certain circumstances, I will later need to resize this array with realloc. Is there any way to initialize an array with malloc/calloc with values, or fill an array with several other values?
Share
You cannot initialize a
malloced array this way, your best chance is to have it statically in your program, and copy it to amalloced array at the beginning of the run, e.g.: