I have to write an algorithm that decides if two structs are structurally equivalent. This is more theory that real programming so pseudo-code in something that sort of looks like C would be fine. Basically I have to compare scalers, arrays, pointers, and structs. So if anyone can provide any help or hints it would be greatly appreciated.

Well, that makes sense that you can't directly compare them, I guess that's why I have to write it myself, field by field. Thanks for the link though.

>I have to write an algorithm that decides if two structs are structurally equivalent.

#define equivalent(a,b) ( sizeof ( a ) == sizeof ( b ) )

It's as simple as that. Since you didn't specify what you mean by "structurally equivalent", we're free to assume that a byte is a byte and if the size of the structures are the same then they're structurally equivalent.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.