What is the simplest way to reset array values to 0?
Assume we have a pointer(e.g., defined as int* p) to the beginning of an array and the size of the array(e.g., 1000). We want to reset all 1000 array values to 0. What is the simplest way?
The simplest way would be to use memset.
memset(p, 0, 1000 * sizeof(int));