| delorie.com/archives/browse.cgi | search |
| From: | Mark Phillips <umphill5 AT cs DOT umanitoba DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Dynamic Array - Need HELP |
| Date: | Sun, 4 Jul 1999 22:55:43 -0500 |
| Organization: | The University of Manitoba |
| Lines: | 28 |
| Message-ID: | <Pine.GSO.3.96.990704225318.21776A-100000@gold.cs.umanitoba.ca> |
| References: | <TqRf3.25$Ew4 DOT 7061 AT wagner DOT videotron DOT net> |
| NNTP-Posting-Host: | gold.cs.umanitoba.ca |
| Mime-Version: | 1.0 |
| X-Trace: | canopus.cc.umanitoba.ca 931146950 20695 130.179.24.1 (5 Jul 1999 03:55:50 GMT) |
| X-Complaints-To: | Postmaster AT cc DOT umanitoba DOT ca |
| NNTP-Posting-Date: | 5 Jul 1999 03:55:50 GMT |
| In-Reply-To: | <TqRf3.25$Ew4.7061@wagner.videotron.net> |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
| X-Mailing-List: | djgpp AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
> I want to create a array of size mpx by mpy.
> After this code, sizeof(v) = 8, why ???
>
well, because v is a pointer to a pointer, and the size of any pointer is
8 bytes. don't worry, your memory is allocated fine, it's just that since
it is dynamically allocated, you can't use sizeof() to check how much
memory you allocated.
mark
> unsigned char **v;
> int mpx,mpy,i;
>
> mpx=64;
> mpy=48;
>
> v = new unsigned char*[mpy];
> for(i=0;i<mpy;i++)
> {
> v[i]=new unsigned char[mpx];
> }
>
>
>
>
>
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |