
Can we write a generic byte-swap function for any struct in C?
Hello, I am not a native speaker so please forgive my language level.
Today I was working on my packet analyzer project. I was refactoring the code and I realized something: there are a lot of functions just to swap the byte order for every header (struct).
So I have a question: Can I build a function/program in C that can automatically swap the byte order of every field in any struct?
thank you all and this my project link : vex-packet-analyzer