šŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.migration
Article #53

Re: newbie question

#53
From: Colin B Maharaj
Date: Tue, 28 Sep 2004 00:38
57 lines
2076 bytes
Before I can answer this, you must know where you are getting memory 
from to create your array or any data structure. Basically there are two 
parts of memory you can use

1. The Stack
2. The Heap

If you are using the Stack an array like a character array will look 
like this....

char s[80];

If you are using the heap, then you will use a pointer instead .
The code will look like this....

char *s = new char [80];

or

char *s;
s = new char [80];

WARNING WARNING WARNING......

Whenever you use memory from the heap you must manually give it back to 
the operating system like this.....

delete s;

If not you get a memory leak and could mess up windows.

remember for every new you must have a corresponding delete.

cheers!






Ricardo Cescon wrote:
> Hello Iļæ½m new in the world of C/C++,
> 
> my question is how to handle a Array like VB or other higher language with C/C++.
> 
> I will be thankfull for a sample!!!!
> 
> best regards
> 
> Ricardo Cescon
> Software Developer
> 
> 
> transact
> Elektronische Zahlungssysteme GmbH
> A Euronet Worldwide Company
> 
Technical Details
Message-ID: <4158b283@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40f54305@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 110f51,43afb45cd865d8f5
X-Google-Attributes: gid110f51,public
X-Google-Language: ENGLISH,ASCII
Date: Mon, 27 Sep 2004 20:38:26 -0400
From: Colin B Maharaj <noreply@myhost.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040219
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.migration
Subject: Re: newbie question
References: <40f54305@newsgroups.borland.com>
In-Reply-To: <40f54305@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 200.108.15.19
Message-ID: <4158b283@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1096331907 200.108.15.19 (27 Sep 2004 17:38:27 -0700)
Lines: 57
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail