<< split from How do I compare structures?? >>
I know this thread is very old, but:
<< but you didn't read the rules, but posted anyway.. http://cboard.cprogramming.com/c-pro...e-posting.html >>
Is it possible to compare structures using memcmp if one assures that the pad bytes are always 0? I mean;
Code:
struct test a, b;
memset(&a, 0, sizeof(struct test));
memset(&b, 0, sizeof(struct test));
/* Code to set a and b values here */
if (memcmp(a, b, sizeof(struct test))) {
/* do something */
}
What i'm indirectly asking is: Are the members of both structs (a and b) assured to be padded the same way??