sturct or union is given. how to swap it? exchange each data???
GCC said that It wasn't a structure or union in exchange(&sf1.k, &sf2.k), exchange(&sf1.s, &sf2.s) and exchange(&sf1.f &sf2.f);Code:#include <stdio.h> typedef struct { int k; int s; int f; }sfType; void exchange(int *x, int *y) { int t = *x; *x = *y; *y = t; } void exchangeSF(sfType *sf1, sfType *sf2) { exchange(&sf1.k, &sf2.k); exchange(&sf1.s, &sf2.s); exchange(&sf1.f, &sf2.f); } ........... int main() {.........}