"void **" : Is it valid and what does it mean?

Asim Jalis aj3u at jade.cs.virginia.edu
Tue May 28 11:36:33 AEST 1991


I want to write a function that takes as arguments pointers to
pointers to any type.  As in,

func(void **p)
{
...
}

main()
{
  int *i;
  float *f;
  char *c;

  func(&i);
  func(&f);
  func(&c);
}

However, the compiler gives me warnings about incompatible type for
all the function calls.  The code itself works fine, but I was
wondering if somehow I could also get rid of the warnings, perhaps by
doing this in a more elegant way.

Basically what I want is a type that would coerce to a pointer to a
pointer to a type, for any type.  Sort of one level beyond simple
"void *".

Any help would be appreciated.

Asim Jalis.



More information about the Comp.lang.c mailing list