|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Stupid Variable question....
I have a stupid question about my code that just wont work..........
In all my code I've always setup the variables I need in user_routines_fast.c for auto, and user_routines.c for the main. Now I want to use the same variable in both files, how could I go about doing this? Thanks |
|
#2
|
|||||
|
|||||
|
Re: Stupid Variable question....
Quote:
Code:
user_SerialDrv.c:55: unsigned char aBreakerWasTripped; // Creates the variable. user_routines.c:22: extern unsigned char aBreakerWasTripped; // Tells the compiler the variable exists in another module. |
|
#3
|
||||
|
||||
|
Re: Stupid Variable question....
Or, you can keep the variables in their files and add a definition in user_routines.h
example: Code:
#define LEFT p1_y |
|
#4
|
|||
|
|||
|
Re: Stupid Variable question....
Typically the extern is put in a .h file that is included in all the .c files you want to use it in.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Camera variable scope question | Validius | Programming | 1 | 28-01-2006 09:24 |
| Stupid question but... | Adam Y. | Math and Science | 6 | 16-02-2004 19:29 |
| Really stupid question | psychoCHIPMUNKK | Kit & Additional Hardware | 3 | 15-02-2004 00:26 |
| stupid question x10 | Tom Bottiglieri | CD Forum Support | 1 | 04-02-2004 22:40 |
| And here's Fishy for stupid question time.. | A. Leese | Chairman's Award | 1 | 23-10-2001 22:38 |