Memset has many usage network resources. The following is my personal experience. ========================================================== ======================================
Memset usage
(The third parameter is the number of bytes) 1. For the character array char a [10]; memset (A, 'A', sizeof (a); 2, for integer arrays int A [10]; memset (A, 0, sizeof (INT) * 10); integer Arrays can only be filled with 0 and-1, the double type can only be filled with 0. if memset (A, 0, sizeof (a) is used according to the double type principle of binary storage, it can be safely executed in vs2005, but the runtime error is reported on OJ.
//Reserves the right to final interpretation. If memset (A,) is used, the array is garbled because int requires four bytes to represent a decimal number. Only two half ================================================= ============================================================ comparison of sizeof (INT) the relationship between sizeof (A) and sizeof (INT) is the number of bytes to obtain the type. If the operating system is 32 bits, the result is 4, and sizeof () obtains the number of bytes of; ========================================================== ====================================== sizeof () perform the following operations on struct and classes: struct def {int data; double data1; char data2 ;}; total number of bytes: int M = 4 + 4 + 8 + 1 = 17,17> sizeof (double), add to the multiples of sizeof (double) because according to the VC alignment rule, int is obtained and then double, add the total number to 8. Because m> sizeof (double), increase MZ to a multiple of sizeof (double. This sizeof (double) is the maximum number of bytes in the structure. ========================================================== ============================================================== Today I made a simple after the DP question, I found that I don't know much about memset and sizeof. Supplement the basics. ========================================================== ======================================== Reference materials: bytes ~~