www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/21/20:53:41

Message-ID: <3928846B.E7DD13CF@fujixerox.co.jp>
Date: Mon, 22 May 2000 09:50:51 +0900
From: Burgupalli Chaitanya <Chaitanya DOT Burgupalli AT fujixerox DOT co DOT jp>
Organization: Wipro Technologies
X-Mailer: Mozilla 4.72 [en] (Win98; I)
X-Accept-Language: en,ja
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: allocated memory size
References: <200005190942 DOT LAA19117 AT acp3bf DOT physik DOT rwth-aachen DOT de> <Pine DOT LNX DOT 4 DOT 10 DOT 10005200546470 DOT 2249-100000 AT roadrunner DOT grendel DOT net> <0c0dis0brlemhqhikei7d46sndbsvu9drd AT 4ax DOT com>
Reply-To: djgpp AT delorie DOT com

thank you all for the response. the reason I to know the the allocated
memory size:

i am trying to read a text file with comma seperated values into 
an array. The only way i figuered i could do that is by allocating 
memory and adding new elements to the array. The length of this 
array would be needed if i try to sort it or search the 
contents...

I think keeping track is the only way to know the amount of memory.

thank you all again
chaitanya b

Chris Mears wrote:
> 
> On Sat, 20 May 2000 05:47:31 +0600 (LKT), that hoopy frood Kalum
> Somaratna aka Grendel wrote:
> 
> >On Fri, 19 May 2000, Hans-Bernhard Broeker wrote:
> >
> >> In article <39249FAE DOT F0428E1F AT fujixerox DOT co DOT jp> you wrote:
> >> > I am sorry if my question are too silly. I am absolute novice at
> >> > programming in C and that is the reason for the question.
> >>
> >> > Problem:
> >> > Is there any way I can find out the number of bytes of memory that has
> >> > been allocated to a pointer.
> >>
> >> None that would be reliable. If you think you need that information,
> >> you'll have to keep track of it yourself.
> >
> >Actually Why would you need to know how much of bytes has been allocated
> >to a pointer...
> 
> Perhaps so that you don't overrun an array's bounds.  For example:
> 
> void fill(int *array, size_t elem)
> {
>         size_t i;
> 
>         for (i = 0 ; i < elem ; i++) {
>                 array[i] = i;
>         }
> }
> 
> In this case you need to know the amount of storage that the array has
> been allocated.
> 
> --
> Chris Mears
> ICQ: 36697123

-- 
**************************************************************
B. Chaitanya 
Senior Systems Engineer
Wipro Technologies
Survey No. 64, Serilingampalli Mandal,
Madhapur, Hyderabad - 500033
Tel: 81-090-7005-4697
Fax: 
E-mail: Chaitanya DOT Burgupalli AT wipro DOT com (Wipro Technologies)
          Chaitanya DOT Burgupalli AT fujixerox DOT co DOT jp (Fuji-Xerox)
www.wipro.com
The World's First SEI CMM Level 5 Software Services Company
**************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019