Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Is there any way to pass a reference to a structure without knowing what type of structure it is? For example:
Is there a pointer type that can hold a reference to one of these structures without knowing which one it is? Let's say I wanted one function to deal with both types:
Assuming I had a parameter to tell me which type of structure was being passed to it (e.g. an integer value), is there another parameter that would accept any reference? I tried to use void *, however I can't access the structure members with that. So is that possible within a single function, or would I need a separate function for each structure type?
Apologies if I haven't expressed myself clearly enough.
0 · ·