KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am working on an assignment in C where I need to pass in an unknown type of parameter into a function. For example, suppose I have the following: int changeCount(void* element) { element.Count = element.Count++; return 1; } The reason why variable element is void is because there are three types of possibilities. All three, however, do have a member variable named "Count". When I try to compile the actual code I wrote in Eclipse , I get the following error: error: request for member ‘Count’ in something not a structure or union I am guessing this is happening because the compiler doesn't know the type of "element" before hand. However, why isn't this working?
Tags (comma-separated)
Save Edits
Cancel