🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #205

Re: C Programming : Need help please .

#205
From: CalvinKong
Date: Tue, 19 Jan 1999 00:00
49 lines
2524 bytes
Can you explain in more detail ? The part that I don't understand is that it
still work if I choose ignore in the popup Error box . So , this message is
just merely a warning and not an error .

--
- Calvin Kong -
----------------------------------------------------------------------------
--------
Are you dare enough to enter my homepage ?
Homepage : http://members.xoom.com/calvin_kong/
Email          : ypkong@tm.net.my
ICQ             : 3715937
----------------------------------------------------------------------------
-------

Martin Ambuhl wrote in message <36A2D431.D11CAB41@earthlink.net>...
>CalvinKong wrote:
>>
>> I had find out the part that causing the problem . But I still don't know
>> why it occurs .. Logically , it should be okay . Here is a program that I
>> extracted out and modified , please discuss with me ...
>> ************************************************************
>> # include <stdlib.h>
>> typedef struct ListType {
>>  int       item;
>>  struct ListType *link;
>> }Node;
>> typedef Node *List;
>>
>> int main()
>> {
>>  List temp;
>>
>>  temp = (List)malloc (sizeof(List));
>
>sizeof(List) is just the size of a pointer.
>If you would do with a typedef less, you would not confuse yourself:
>   Node *temp;
>   temp = malloc(sizeof *temp);
>/* or, to be slightly less safe, 'temp = malloc(sizeof(Node));' */
>remember to check the return value from malloc.
>
>
>
>
>--
>Martin Ambuhl (mambuhl@earthlink.net)
>Note: mambuhl@tiac.net will soon be inactive
>
Technical Details
Message-ID: <36a37c53.0@news2.tm.net.my>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36a2cb23.0@news2.tm.net.my> <36A2D431.D11CAB41@earthlink.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114592,44c9aa94f48f7403
X-Google-Attributes: gid114592,public
X-Google-Thread: f9d99,44c9aa94f48f7403
X-Google-Attributes: gidf9d99,public
X-Google-Thread: 109edf,44c9aa94f48f7403
X-Google-Attributes: gid109edf,public
X-Google-Thread: 1011f8,44c9aa94f48f7403
X-Google-Attributes: gid1011f8,public
X-Google-Thread: 10d4ba,44c9aa94f48f7403
X-Google-Attributes: gid10d4ba,public
From: "CalvinKong" <ypkong@tm.net.my>
Subject: Re: C Programming : Need help please .
Date: 1999/01/19
Message-ID: <36a37c53.0@news2.tm.net.my>
X-Deja-AN: 434230813
X-NNTP-Posting-Host: bat-46-144.tm.net.my
References: <36a2cb23.0@news2.tm.net.my> <36A2D431.D11CAB41@earthlink.net>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-Trace: 19 Jan 1999 02:24:19 +0800, bat-46-144.tm.net.my
Organization: TMnet Malaysia
Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,jaring.pcbase,tmnet.communities,tmnet.support