Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!mit.eternal-september.org!.POSTED!not-for-mail From: Richard Newsgroups: comp.lang.c Subject: Re: coding dynamic allocation question Date: Sat, 19 Apr 2014 14:57:18 +0100 Organization: http://www.ieee.org/ Lines: 22 Message-ID: <87mwfhcthd.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mit.eternal-september.org; posting-host="bdee7d74bb5599725cdba9fe2a37525e"; logging-data="29940"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XIty5lcHuUX2sWCfRbE2JVY4nM0wNTQ8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:pHU2Y3r6+zF7Nb90BHaUsIilTWI= sha1:oNaNPzh6m4Re/GCYoHtsP6BiXGs= Xref: csiph.com comp.lang.c:43123 "Bill Cunningham" writes: > I guess these two statements are not the same. Why not? I guess I > haven't learned this I haven't used it much. > > int *p; > p=malloc(sizeof (int)); //seems to be in error > p=malloc(sizeof (int *)); //is the correct coding > > What exactly is the difference? > > Bill > 8/10 Someone will think you're serious and provide a horrifically long laboured reply though no doubt. -- "Avoid hyperbole at all costs, its the most destructive argument on the planet" - Mark McIntyre in comp.lang.c