Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 27th, 2012  |  syntax: None  |  size: 0.45 KB  |  views: 136  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to make global variable in libray project using MPLAB X IDE
  2. void abcTest(int n){
  3.     // I want store n as global variable
  4. }
  5.        
  6. #ifndef _ABC_H
  7. #define _ABC_H
  8.  
  9. void abcTest(int n);
  10.  
  11. #endif;
  12.        
  13. #include "abc.h"
  14.  
  15. void main(void) {
  16.     abcTest(10);
  17. }
  18.        
  19. extern int global_a;
  20. void abcTest(int n){
  21.     global_a+=n;
  22. }
  23.        
  24. #ifndef _ABC_H
  25. #define _ABC_H
  26.  
  27. void abcTest(int n);
  28.  
  29. #endif;
  30.        
  31. #include "abc.h"
  32. int global_a;
  33.  
  34. void main(void) {
  35.     abcTest(10);
  36. }
clone this paste RAW Paste Data