From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,2b585bfb397fe81e X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-08-07 13:56:03 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: harley_chan@hotmail.com (Tylenol) Newsgroups: comp.unix.tru64 Subject: Re: how to determine the size of dynamic array?? Date: 7 Aug 2003 13:56:02 -0700 Organization: http://groups.google.com/ Message-ID: References: <6_sYa.1689$K_4.849@news.cpqcorp.net> NNTP-Posting-Host: 130.113.100.163 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1060289763 25316 127.0.0.1 (7 Aug 2003 20:56:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 7 Aug 2003 20:56:03 GMT Xref: archiver1.google.com comp.unix.tru64:10540 Thanks Ed Vogel, For dynamic array, the block of memory is allocated by "malloc()" such as int *a = malloc(16); When I use sizeof(a), it gives me 8 not 4. Anything wrong?? or I use the "sizeof()" function in wrong way. some correction in the previous message: the "mallocate()" should be "mallocblksize(): Thanks Harley "Ed Vogel" wrote in message news:<6_sYa.1689$K_4.849@news.cpqcorp.net>... > If by "dynamic array" you mean what the C Standard calls > "variable length array", the C compiler on Tru64 has this > support, and you just use the sizeof() operator to get the > size of the array. For example: > > int x = 5; > main() { > int a[x]; /* Declare a varible length array */ > printf("size is %d\n",sizeof(a)); > } > > will emit: "size is 20" when run. > > Ed Vogel > HP C Engineering > > "Tylenol" wrote in message > news:becbc481.0308061530.22556518@posting.google.com... > | Hi All: > | Does anyone have ideas how to determine the size of dynamic array? I > | know MSVC have a function called "_msize()" which doing this kind of > | job. However, I am not sure on Unix Tru64 have a similar function or > | not. The most similar function I found is "mallocate()" but this > | function returns the array size is always larger than original > | requested size of array. Any function in Unix Tru64 doing the same job > | as "_msize()"? Please Help!!! > | > | Thanks in advance > | Harley