This is some code I've inherited in a project that I need to modify - the original was done in Borland C++ 3.1 in the DOS days. I don't use memset, so I'm wondering if this is valid. The point of it is to initialize the contents of an array of structures to zero:
Is this an OK thing to do?Code:struct hsdata { unsigned long wgpin; unsigned long pxpin; unsigned long iclasspin; char iclass_csn[21]; unsigned int hsindex; }; void some_function() { struct hsdata hs_unsorted[2400]; // array of structures int z; // Clear hsdata structure for(z = 0; z < 2400; z++) { memset(&hs_unsorted[z],0,sizeof(hsdata)); } }
Thanks




Reply With Quote