Reinitialize timeval struct
问题 How can I reinitialize a timeval struct from time.h? I recognize that I can reset both of the members of the struct to zero, but is there some other method I am overlooking? 回答1: The completely correct and portable (albeit C99) way to zero-initialize arbitrary (possibly aggregate) types: myTime = (struct timeval){0}; This works even for structures that contain pointers and floating point members, even if the implementation does not use all-zero-bits as the representations for null pointers