| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Function Pointers |
Hello Neil!
Replying to a message of Neil Heller to Darin McBride:
DM>> So then you may have a struct like this:
DM>> struct Database {
DM>> HDLL hdll; /* can't remember the exact type ;-> */
DM>> error_t (*GetEmployee)(struct EmpRecord* r);
DM>> error_t (*SaveEmployee)(struct EmpRecord* r);
DM>> };
NH> That brings up another point. How do you create a function pointer
NH> that returns something other than that which was passed-in? For
NH> example, if GetEmployee() above were to return a pointer to double
NH> and SaveEmployee() were to return a pointer to a structure of type
NH> struct foo?
double* (*GetEmployee)(char const* emp_name);
struct foo* (*SaveEmployee)(struct EmpRecord* r);
Of course, the functions that these could point to would need to change similarly.
Darin
---
* Origin: Tanktalus' Tower BBS (1:250/102)SEEN-BY: 633/267 270 @PATH: 250/102 99 10/345 106/1 2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.