Questions about pointers to objects and pointers to functions
- From: Marc Thrun <TekWarrior@xxxxxx>
- Date: Mon, 19 Sep 2005 13:47:31 +0200
Hello,
I've got a few questions:
1) Given the two structs
struct A {
int x;
};and
struct B {
struct A y;
int z;
};is it ok to treat a "pointer to an object of type struct B" as a "pointer to an object of type struct A"?
(I think someone asked something like this some time ago, but unfortunately I can't find the article anymore)
2) When I now have a function pointer of type void (*fpa)(struct A *, int); and a function pointer of type void (*fpb)(struct B *, int);
and the corresponding functions void fa(struct A*,int); and void fb(struct B*,int);
is it ok to assign a "pointer to fa" to fpb and call the function through fpb with a "pointer to an object of type struct B" as the first parameter?
Thanks in advance Marc Thrun .
- Follow-Ups:
- Re: Questions about pointers to objects and pointers to functions
- From: Tim Rentsch
- Re: Questions about pointers to objects and pointers to functions
- From: SM Ryan
- Re: Questions about pointers to objects and pointers to functions
- Prev by Date: Re: I'm new
- Next by Date: Re: incomplete arguments to function pointers
- Previous by thread: Re: Function with variable number of arguments
- Next by thread: Re: Questions about pointers to objects and pointers to functions
- Index(es):
Relevant Pages
|
|