www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/11/20:47:53

Xref: news2.mv.net comp.os.msdos.djgpp:4858
From: amethyst AT pcc-uky DOT campus DOT mci DOT net (Amethyst)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Question about pointers
Date: 11 Jun 1996 22:18:36 GMT
Organization: CampusMCI
Lines: 39
Message-ID: <4pkrbs$55v@news.campus.mci.net>
References: <4phibg$sek AT usenet DOT rpi DOT edu>
NNTP-Posting-Host: s28-pm01.pcc-uky.campus.mci.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <4phibg$sek AT usenet DOT rpi DOT edu>, calvid AT cortez DOT its DOT rpi DOT edu says...
>
>[SNIP]
>struct big
>{
>        int array[10000];
>}
> /* [SNIP] */
>big zero;
>big *one;
>big *two;
>big *three;
>
>one = two = three = &zero;
>
>1) Obviously the first line, big zero, will allocate 40k of memory
>to store itself in.  But what about big *one, etc?  Do they also
>take up 40k of memory, or just enough space to hold an address?

one, two, three are only pointers. They only take up enough space to hold an 
address

>
>2) In the one=two=three=&zero line, do the pointers now take up 40k
>of memory each, or just enough to hold an address?
>
>What I really need to know is if you can make many pointers pointing
>to one variable and save memory that way.  Thanks in advance.
>

These all point to the same variable. For example, changing *one will also 
change zero, *two, and *three

-- 
amethyst AT pcc-uky DOT campus DOT mci DOT net
 The me that you know, he used to have feelings
 But the blood has stopped pumping, he is left to decay
http://www.angelfire.com/pages0/amethyst/index.html

- Raw text -


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