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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The completely correct and portable (albeit C99) way to zero-initialize arbitrary (possibly aggregate) types:
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 and floating point zeros.