Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing types as function parameters...

Status
Not open for further replies.

Nosferatu

Programmer
Jun 9, 2000
412
RO
I know this is not possible in C and it may sound as a stupid question.

Anyway, has anybody any idea if this can be avoided by some tricks of some sort?
Its' all about typecasting a (void *) pointer to an appropriate type recieved as a parameter.

I would like to know as much as possible about the type of a pointer, how that exactly works. I know that a pointer is a 32 bit value, that basically holds the memory adress of a variable and the type of the pointer is used by the compiler, when dereferencing the data in the pointer.

Well, i would like to be able to have the necesary information about a pointer type, passed as an function argument.
How can it be done?
Compilers do it, so it has to be done in C, in some manner.

I have a general idea, but it involves too much code writing, so i would like some clues.

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top