c++ array initialize to 0 code example
Example 1: zeros of array c++
int A[5]; // Entries remain uninitialized
int B[5]= { 0 }; // All entries set to zero
Example 2: initialize dynamic array c++ to 0
int *arrayName = new int[10]{0};
//Print array elements
for(int i=0; i<10; i++ { cout<<arrayName[i] <<" "; }
Example 3: initialize whole array to 0 c++
int nScores[100] = {0};
Example 4: c++ initialise array
int nCount[] = {1, 2, 3, 4, 5};