View Single Post
  #5   Spotlight this post!  
Unread 02-03-2005, 19:27
JoelP JoelP is offline
whats the P for? Pazhayampallil
FRC #1155 (Bronx Science Sciborgs)
Team Role: Leadership
 
Join Date: Dec 2004
Rookie Year: 2005
Location: bronx, new york
Posts: 62
JoelP is a jewel in the roughJoelP is a jewel in the roughJoelP is a jewel in the rough
Send a message via AIM to JoelP
Re: Static Variables

No, there is no need for the declarations function. Just declare the variable outside of all functions. This will make that variable a global variable so it will be available to all the functions in the file. Also the extern int declaration is not needed when the variable is a global variable.

Your code with the above modifications would look like this:
Code:
MyFunction.c

int bob=2;

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

Last edited by JoelP : 02-03-2005 at 19:30.