Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!cs.utexas.edu!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: Pointers, Structs, and Arrays Message-ID: <722@sdrc.UUCP> Date: 10 May 89 21:42:26 GMT References: <743@mccc.UUCP> Distribution: usa Organization: Structural Dynamics Research Corp., Cincinnati Lines: 28 In article <743@mccc.UUCP>, pjh@mccc.UUCP (Pete Holsberg) writes: > struct foo > { > char bar[20]; > } list[100]; > > *list[i].bar = '\0'; > > Now I know that the last line points to the first character in the bar array > In each struct variable, but how? If bar = &bar[0], how so the '*' and the > '&' "get together" to make the last line equivalent to > list[i].bar[0] Well, the problem is that bar is NOT equivalent to &bar[0]. Rather, list[i].bar is equivalent to &list[i].bar[0], which should make it easier to see how the "*" and the "&" get together. What you have to realize is that bar DOES NOT EXIST -- since it is a member of a structure, it only exists as part of an actual instance of the structure and must be referenced as such. ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@SDRC.UU.NET 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 "You can't get a body like mine in a bottle -- unless you push REAL HARD." - Judy Tenuta / Dr. Pepper