about memset fuction

Dear all,
In my code,i am planning to use memset function to re-initialise an array before populating it everytime. Will using memset function be an overload to the program?

memset is usually the most efficient way to initialize an data area. It should not contribute very much to the load.

Thanks Perderabo. :slight_smile:

low-level standard C library functions like memcpy and memset are almost always implemented as the most efficient possible manner fro the hardware. Some environments use libc when optimization is turned off for these modules. Check you compiler's man page. Turning optimation on forces the compiler/linker to load in the most efficient version in those environments.

As an example of this, HPUX has a millicode version of memset - a very fast implementation. It also has an entry point for a non-millicode memset in libc, _memset20