memset on array of structures in C++
- by garry
I have another memset question. It appears as if the code I am editing may have some issues (or it's not done the same way in different files)
A::LRM las[9]; //A and LRM are both structures with BOOLS and INTS
memset(&las, 0, sizeof(las));
typedef Sec SecArray[16];
SecArray rad_array;
memset(rad_array, 0, sizeof(SecArray));
The second example appears to be correct because rad_array is the same as the first position in the array. Then the sizeof(SecArray)) would make sense. The first one doesn't seem correct to me. All structs are just BOOLs and INTS nothing dynamic in them.
My understanding from my other post about memset was that it followed this format.
memset("pointer to object", "what to set it to", "size of object")
Can anyone tell me what exactly is going on here if I am incorrect with my theory.