![]() |
Global Variable Placement
I've tried to insert global variables in various places in Kevin's code only to get stack overflow, code errors (RC), sytax errors, compiler crashes and general system crashes. Where do you all put your global variables. I'm interested in global only. I'd like to minimise passing information between functions. Thanks
|
Re: Global Variable Placement
Quote:
// this allocates memory unsigned int foo; Then in teleop.h I declare the variable again with the keyword extern: // no memory is allocated, but lets the compiler know the name (foo) // and type (unsigned int), and that it is located in another source file extern unsigned int foo; Then include teleop.h at the top of each source file that needs to use foo. The line will look like this: #include "teleop.h" -Kevin |
| All times are GMT -5. The time now is 23:10. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi