--- tulip_rasputin <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I have a function, foo(), defined in a file a.c
> which defines and 
> uses a variable named xxx. Now i have another
> function, bar(), 
> defined in some other file, b.c, which also uses a
> static variable 
> named xxx. Now foo() calls bar() and both manupilate
> xxx. Can 
> something go wrong here?
> 
> The two functions foo() and bar() go something like
> this:
> 
> func foo() /* defined in a.c */
> {
>   int xxx = 0;
This xxx has the scope of this function.  When xxx is
used in this function it will refer to this copy of
xxx.  It will ignore a static deined xxx even in this
same file.

Ray
> 
>   bar(&xxx);
> 
>   /* Some more processing is done on xxx */
> 
>   printf ("%d\n", xxx)
> }
> 
> bar (int *yyy) /* defined in b.c */
> {
>   int z = xxx; /* xxx is a static variable defined
> in the file b.c */
> 
>   /* Do some Processing on z */
> 
>   *yyy = z;
> }
> 
> Any help in this regard would be really appreciated.
> 
> Thanks,
> Tulip
> 
> 
> 



      
____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

Reply via email to