Assignment of void pointer variable

Jim Bittman jmbj at grebyn.com
Sun Feb 18 09:15:36 AEST 1990


I am a newcomer to C programming, but I always thought C was MORE
flexible in the handling of variables and pointers than pascal.
I can make an assignment to an unspecified pointer type in pascal in one
step as follows:
var
   varptr : array[0..9] of pointer;
   myint : integer;
begin
   myint := integer(varptr[5]^);
end.
This works in C, but I'd like to combine the last two lines...
  void *varptr[10];
  int  *intptr;
  int  myint;
  intptr = varptr[5]; 
  myint = *intptr;
Goal:  myint = (int) *varptr[5];  /* doesn't work, it's what I want! */
Post or mail suggestions, Thanks for the help!
Jim Bittman
jmbj at grebyn.com



More information about the Comp.lang.c mailing list