View Single Post
  #5   Spotlight this post!  
Unread 24-01-2008, 16:52
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: #define's scope?

Quote:
Originally Posted by Damien1247 View Post
#define is a preprocessor command, the scope is through whatever file(s) you include it in. Least that is how it works if you have them in .h files. If your #define is in a .c file it is global to the file. Hope this helps.
The only thing I would add to this is that it is only global after the line on which it is defined. I suppose this is the same as any other global variable, except global variables have to be defined at the top of the file, or the top of the function. #defines can be used anywhere.
__________________
Code:
void function(void)
 {
  function();
 }