Hot answers tagged


It's not really clear what you mean by "swapping elements". I can't see why you'd change one element in a struct, but I can see how you might want to swap entire structs. Say that you have a struct like this: typedef struct { string name; int votes; } candidate; Now, say that you have two structs, a and b, and they have been populated ...

Only top voted, non community-wiki answers of a minimum length are eligible