IT Placement Papers Programming C
This category contains C Interview Questions and Answers |
Why can't you compare structures?
|
|
|
|
|
There is no single, good way for a compiler to implement
structure comparison which is consistent with C's low-level
flavor. A simple byte-by-byte comparison could founder on
random bits present in unused "holes" in the structure (such
padding is used to keep the alignment of later fields correct; A field-by-field comparison might require
unacceptable amounts of repetitive code for large structures.
If you need to compare two structures, you'll have to write your
own function to do so, field by field.
Only registered users can write comments. Please login or register.
|