| www.delorie.com/archives/browse.cgi | search |
| From: | "Preacher" <trulsuh AT stud DOT idb DOT hist DOT no> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Using pointers |
| Date: | Fri, 7 May 1999 11:21:14 +0200 |
| Organization: | HiST |
| Lines: | 17 |
| Message-ID: | <7guboo$g8q$1@balder.stud.idb.hist.no> |
| References: | <Pine DOT BSF DOT 3 DOT 96 DOT 990507090735 DOT 15546B-100000 AT studenti DOT ing DOT unipi DOT it> <7gu5bt$u5e$1 AT hagen DOT cloud9 DOT co DOT uk> |
| NNTP-Posting-Host: | preacherson.tihlde.org |
| X-Trace: | balder.stud.idb.hist.no 926069336 16666 158.38.48.55 (7 May 1999 09:28:56 GMT) |
| X-Complaints-To: | usenet AT idb DOT hist DOT no |
| NNTP-Posting-Date: | 7 May 1999 09:28:56 GMT |
| X-Newsreader: | Microsoft Outlook Express 4.72.3155.0 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3155.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
>/* C++, I think this is how to do it */
>myptr = new (int)[n];
You should not have paratheses around the int as in:
myptr = new int[5];
Also, you should remember to free the allocated memory after use, using:
delete [] myptr;
Truls.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |