• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# transfering void names

## Recommended Posts

menu[num_items].whereto = linksto; (where "whereto" & "linksto" are void''s) I am attempting to transfer the name of a void function onto a reference to that function, do I need to declare "linksto" and "whereto" as pointers? my compiler gives errors on this line of code saying the left side has something wrong... (VC++ 6)

##### Share on other sites
Eh???

you cant have a void data type, the void keyword is simply a placeholder for a datatype where there is none. You can have a void* though, which is a pointer to an unknown data type. You mention functions - Are these supposed to be function pointers? If so, provided the calling conventions and parameter lists are the same, there should be no problem.

  typedef void(*pFunction)(void);typedef struct{ .. .. pFunction whereTo;}item;item menu[num_items];void linksto(void){ .. ..}int main (void){ .. .. menu[0].whereto = linksto; .. .. return 0;}

If this doesnt help, please be give more details to explain your problem.

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627654
• Total Posts
2978447

• 10
• 12
• 22
• 13
• 33