🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: csu.cs.200
Article #115

Re: Program 4 initialize

#115
From: cassic
Date: Tue, 13 Oct 1998 00:00
32 lines
2325 bytes
I'm not positive I understand your question perfectly, but I think the issue
is how to initialize the lists, when the first call to a list is "AddAtEnd"
as opposed to something like "INITList."  (Let me know if that's not what you
meant).  Remember that classes have constructors instead of initialization
functions (well, you could still have an init function, but here we don't
need one).  Whenever you declare an object of that class, the constructor for
the class is called - i.e. when you declare a list the constructor (or
"initializer") gets called automatically.  Since you have to have declared a
list variable before you can call AddAtEnd, this initialization must have
already taken place.

Hope that helps.

Chris

In article <6vm3nr$bh3c@yuma.ACNS.ColoState.EDU>,
  brockmei@glinka.cs.colostate.edu ( christopher brockmeier) wrote:
> Help!  I don't understand how we are supposed to initilize the
> lists when Main4.C simply calls list_name.LIST_AddAtEnd(data);If you cant set
"used" to zero the list doesn't get initial-
> ized, but how can you tell the status of the list?  If it is
> AddAtEnd of nothing that's what I get: nothing.  So I've trid
> to check with an if statement if data[0] (my array) has a null
> value for name, if it does I initialize it.  It doesn't
> compile this way.  Another thing is that LIST_Create and LIST_
> Destroy are getting flagged for not returning values... I
> think my code is exactly as it is in the notes and book for
> this.  If anyone can help please reply! kempf@cs....
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Technical Details
Message-ID: <6vvqta$q88$1@nnrp1.dejanews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6vm3nr$bh3c@yuma.ACNS.ColoState.EDU>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 127144,f08ca94766d56012
X-Google-Attributes: gid127144,public
From: cassic@alumni.stanford.org
Subject: Re: Program 4 initialize
Date: 1998/10/13
Message-ID: <6vvqta$q88$1@nnrp1.dejanews.com>
X-Deja-AN: 400627795
References: <6vm3nr$bh3c@yuma.ACNS.ColoState.EDU>
X-Http-Proxy: 1.0 x7.dejanews.com:80 (Squid/1.1.22) for client 207.168.232.17
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Tue Oct 13 15:16:59 1998 GMT
Newsgroups: csu.cs.200
X-Http-User-Agent: Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u)