Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: "Ed Vogel" <edward.vogel_nospam@hp.com>
Subject: Re: how to determine the size of dynamic array??
Date: Fri, 08 Aug 2003 14:00:50 GMT	[thread overview]
Message-ID: <m2OYa.1834$dP5.326@news.cpqcorp.net> (raw)
In-Reply-To: becbc481.0308071256.2534600a@posting.google.com


"Tylenol" <harley_chan@hotmail.com> wrote in message
news:becbc481.0308071256.2534600a@posting.google.com...
| Thanks Ed Vogel,
| For dynamic array, the block of memory is allocated by "malloc()" such
| as
|
| int *a = malloc(16);
|
    In this case you don't really have a varible-length array, you simply
have
    dynamic storage that you chose to reference as an array.

| When I use sizeof(a), it gives me 8 not 4. Anything wrong?? or I use
| the "sizeof()" function in wrong way.

    When you say sizeof(a), this will give you the size of a, which
    is a pointer.  A pointer on Tru64 is 8 bytes.

    I do not know of a way to find the size of the malloc'ed storage.

    Ed




  reply	other threads:[~2003-08-08 14:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-06 23:30 how to determine the size of dynamic array?? Tylenol
2003-08-07 14:02 ` Ed Vogel
2003-08-07 20:56   ` Tylenol
2003-08-08 14:00     ` Ed Vogel [this message]
2003-08-20 17:59       ` Jerry Feldman
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox