Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!cornell!rochester!ur-tut!sunybcs!boulder!hao!ames!umd5!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: dynamic mem allocation for structures Message-ID: <7005@brl-smoke.ARPA> Date: 9 Jan 88 08:54:17 GMT References: <3834@rosevax.Rosemount.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 9 In article <3834@rosevax.Rosemount.COM> richw@rosevax.Rosemount.COM (Rich Wagenknecht) writes: >junk_ptr = (struct junk *)malloc( sizeof(struct junk)); That's the right method. Two comments: (a) Make sure you properly declare malloc -- don't let it default to int-valued. (b) Ignore the "lint" warnings about possible pointer alignment problems; "lint" doesn't understand that malloc values are always pessimally aligned.