Path: utzoo!censor!geac!torsqnt!hybrid!scifi!bywater!uunet!stan!imp From: imp@Solbourne.COM (Warner Losh) Newsgroups: comp.lang.c Subject: Question about using void * Message-ID: <1991Jan18.225308.25139@Solbourne.COM> Date: 18 Jan 91 22:53:08 GMT Organization: Solbourne Computer, Inc. Lines: 33 Given something like the following: struct foo { void *bar; }; struct foo fred[] = { { (void *) 1}, { (void *) 3} }; struct foo george[] = { { (void *) "Warner"}, { (void *) "Losh"} }; In the program where I see this being done, there is a tag that tells what type each element of the struct foo is, plus some other information. What I've presented here are just the basics. My question is: Is this portable? Can I stuff an integer into a pointer and expect to get it back out again? I know that there are problems with going the other way (stuff a pointer into an int and then try to get it back out). I couldn't find anything in my K&R II to tell me how kosher this method is. Warner -- Warner Losh imp@Solbourne.COM We sing about Beauty and we sing about Truth at $10,000 a show.