delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/08/21:39:57

Message-ID: <00f001bdf2ba$a5bce1e0$12d098cd@dean.co.alachua.fl.us>
From: "Dean Limbaugh" <edl AT ns1 DOT co DOT alachua DOT fl DOT us>
To: <djgpp AT delorie DOT com>
Subject: Re: -KWII- About my stupid questions!!!
Date: Thu, 8 Oct 1998 08:53:29 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Reply-To: djgpp AT delorie DOT com

It's quite possible for two different variables in 2 different function to
have the same value, if they're automatic variables.

Ex
  foo() {
    int x;

   x = 10;
}

  bar {
    int x;

   printf("%d\n",x);
}

...
   foo();
   bar();

would in all probalility print 10;

since function calls and returns don't change the value on the stack were x
is stored in both sub's.

-----Original Message-----
From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Date: Wednesday, October 07, 1998 8:42 PM
Subject: Re: -KWII- About my stupid questions!!!


>Uhfgood wrote:
>
>> if I have a variable that has the same name and type in two seperate
functions,
>> how can their values be the same, aren't they supposed to be different?
>
>    They are, and will be different.  Post a simplified version of the
problem here
>if you still can't figure it out.
>
>--
>     (\/) Endlisnis (\/)
>          s257m AT unb DOT ca
>          Endlisnis AT GeoCities DOT com
>          Endlisnis AT BrunNet DOT Net
>
>

- Raw text -


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