0

Why can't we compare two struct variable having same data

27th Aug 2019, 5:13 AM
Suduli Ray
Suduli Ray - avatar
4 Réponses
+ 8
What Ace meant was that there is no built-in facility (function, operator etc.) that serves the purpose of structure comparison in the C language. I don't know if you have searched this before or not, nor whether you have read what I found in a search based on this discussion, I'm just sharing what I found: https://cboard.cprogramming.com/c-programming/19425-how-do-i-compare-structures.html https://stackoverflow.com/questions/141720/how-do-you-compare-structs-for-equality-in-c And about the slack byte, as I understand it (from the following links below) it refers to padding bytes. I assume this is irrelevant in case we're checking member values equality, as different padding bytes count could mean different member types, and *probably* different signature (two different structure compared). https://stackoverflow.com/questions/3193523/slack-byte-in-structures-in-c https://stackoverflow.com/questions/7300638/slack-byte-in-c-structures
27th Aug 2019, 7:44 AM
Ipang
+ 1
I don't understand what do you mean by language Tool, can you please explain that part, And some one told me there is may be slack byte involving that's why we can't compare two struct variable. Still i am not satisfied this answer about slack byte.
27th Aug 2019, 5:47 AM
Suduli Ray
Suduli Ray - avatar
+ 1
Thanks for the answer, its very helpful
27th Aug 2019, 9:55 AM
Suduli Ray
Suduli Ray - avatar