View Single Post
  #4   Spotlight this post!  
Unread 02-03-2005, 18:48
amateurrobotguy's Avatar
amateurrobotguy amateurrobotguy is offline
Lead Programmer/Senior Engineer
no team
 
Join Date: Feb 2005
Rookie Year: 2000
Location: ****
Posts: 136
amateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these parts
Re: Static Variables

Quote:
Originally Posted by MikeWasHere05
Declare it at the top of a file, then in other files put
Code:
extern int bob;
at the top.
So basically like this.

MyFunction.c

void declarations(void)
{
int bob=2;
}

void hi(void)
{
int bill=0;
extern int bob;
bill=bob+2
}

I need to define a variable in a function and make it available to everywhere in the rest of the file.
__________________
I quit FRC over 2 years ago (more if you're reading this past 2010).

Last edited by amateurrobotguy : 02-03-2005 at 19:05.