Answers for "c how to initialize an array with specific values"

C
3

initialize array in c with 0

static char ZEROARRAY[1024]; // if declaration is in global scope or is static it will alredy be initialized to Zeroes
// OR
char ZEROARRAY[1024] = {0}; // Compiler fills unwritten entries with zeroes
// OR
memset(ZEROARRAY, 0, 1024); // Alternatively you could use memset to initialize the array at program startup:
Posted by: Guest on September-08-2020
1

what the value in array not initialized yet c

it depends, they are garbage values
Posted by: Guest on July-20-2021

Code answers related to "c how to initialize an array with specific values"

Code answers related to "C"

Browse Popular Code Answers by Language