First time using an array and memset, the array is pretty simple but I’m not confident using memset, so I’m cheating and using some code off of the web.
The array:
int F[26] = {0}; //26 element array initialized to all zeros
Then at some point I need to reset the array back to all zeros, so I’m using this:
memset(F, 0, sizeof(F)); //The code in question
So two questions:
Is the memset code correct?
Do I need to “include” any files for memset to work?
The IDE isn’t complaining about any of the code, but I can’t compile and test for a few weeks and I need to get a jump on the coding.
I know I could use a loop to do this or simply change the elements to zero one at a time but I want to try this first.
EDIT: Oh yea...it's C++
The array:
int F[26] = {0}; //26 element array initialized to all zeros
Then at some point I need to reset the array back to all zeros, so I’m using this:
memset(F, 0, sizeof(F)); //The code in question
So two questions:
Is the memset code correct?
Do I need to “include” any files for memset to work?
The IDE isn’t complaining about any of the code, but I can’t compile and test for a few weeks and I need to get a jump on the coding.
I know I could use a loop to do this or simply change the elements to zero one at a time but I want to try this first.
EDIT: Oh yea...it's C++
Last edited: