View Single Post
  #6   Spotlight this post!  
Unread 18-01-2004, 02:08
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Using the extern keyword.

extern is only used in the first declaration of variable in a file - treat it just as if you were declaring the variable normally, extern just says "this variable was originally declared in another file, and the same copy should be used here".

also, remember that exactly one file should have the variable declared without "extern" - all of the other files extern this original declaration.

Finally, remember that extern only really works for global variables. So make sure your extern-ed variables are declared outside of any function calls.

--edit-- lol, it happened again.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)