Message-ID: <34CE51E3.79C09F2C@jet.es> Date: Tue, 27 Jan 1998 21:30:11 +0000 From: "Jordi Pérez" MIME-Version: 1.0 To: Vic CC: djgpp AT delorie DOT com Subject: Re: HELP: accessing astructure members via VOID pointer?? References: <34CD4681 DOT 3747 AT cam DOT org> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Precedence: bulk Vic wrote: > Hello. I'd like to be able to do something like this: > I have a struct foo (int x,y,z) and a void* bar=&foo; > So bar holds the adress of foo. I know that at the beginning of the > struct lies the first member. so why can't I just say *bar=55 or > something? > I'd like to be able to access any member of a struct using a pointer. > Like, if I want to access the second member, I add 4(or whatever) to > the > pointer and write the value to that adress. How could I do that? > HELP!! > TIA, > -- > --> http://www.cam.org/~tudor <-- With -> you can acces any type of struct from a void pointer; Well, you just need to acces to variables in the struct in the next way: bar->x=55; Jordi Pérez Bou, jordimln AT jet DOT es alternative e-mail: e6707357 AT est DOT upc DOT es /**********************************************(Excuse my english)