文章目录
结构体
C 不支持结构体比较。必须通过一一比较所有成员来比较结构体
structs are not valid operands for equality(==), the operands have to be an arithmetic type or a pointer. We can see this from the draft C99 standard section 6.5.9 Equality operators:
One of the following shall hold:
- both operands have arithmetic type
- both operands are pointers to qualified or unqualified versions of compatible types;
- one operand is a pointer to an object or incomplete type and the other is a pointer to a qualified or unqualified version of void; or
- one operand is a pointer and the other is a null pointer constant.