Re: obj function hello()
- From: Ian Collins <ian-news@xxxxxxxxxxx>
- Date: Fri, 09 Feb 2007 13:30:15 +1300
gert wrote:
i started from python actually. I was trying to figure out how to makePlease keep the context you are replying to.
a struct that has data and functions defined in the struct it self ?
You can't have functions in structs in C. What yo can have is function
pointers:
struct Obj {
int someInt;
int (*someFn)(void);
};
But you have to assign a function address to the pointer for each
instance of Obj.
--
Ian Collins.
.
- Follow-Ups:
- Re: obj function hello()
- From: gert
- Re: obj function hello()
- References:
- obj function hello()
- From: gert
- Re: obj function hello()
- From: Ian Collins
- Re: obj function hello()
- From: gert
- obj function hello()
- Prev by Date: Re: obj function hello()
- Next by Date: Re: IS this a proper way of freeing memory with free()
- Previous by thread: Re: obj function hello()
- Next by thread: Re: obj function hello()
- Index(es):
Relevant Pages
|