Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ki4pv.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!hropus!ki4pv!tanner From: tanner@ki4pv.UUCP (Tanner Andrews) Newsgroups: net.lang.c,net.unix Subject: Re: Pointers vs. arrays: another dumb question... Message-ID: <6919@ki4pv.UUCP> Date: Mon, 23-Jun-86 10:57:52 EDT Article-I.D.: ki4pv.6919 Posted: Mon Jun 23 10:57:52 1986 Date-Received: Wed, 25-Jun-86 04:47:00 EDT References: <811@bu-cs.UUCP>, <1242@ncoast.UUCP> Organization: CompuData South, DeLand Lines: 21 Keywords: another (probably dumb) answer... Xref: watmath net.lang.c:9567 net.unix:8364 ) ncoast!allbery writes on the matter of casting a pointer to an ) array of pointers to a struct. For the purposes of malloc casting, I would suggest neither of: (struct foo *)malloc( ) (struct foo (*)[])malloc( ) Try instead the construct: (struct foo **)malloc( ) Consider that you are generating an array of pointers; what you are getting back from malloc() is a pointer to this array. Actually, it points at the first pointer. The same declaration would be appropriate for the variable, of course: struct foo **my_ptr; -- Tanner Andrews