This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

method to avoid global variables

I want to know method, How to avoid global variable in c microcontroller programing? or method to make global variable invisible.
Is there any perticular functions in built in c library?, that could be supportive to avoid global variables or hide global variables.

Parents
  • "Who said anything about all the variables ?"

    I think you know who it was: me.

    "I do, of course, use lots of local variables"

    Ok, ask yourself why you made those variables local rather than global.

    "what I reacted to is the idiotic C thing that some teach "under penalty of severe bodily harm, do not use any global variables""

    Who said anything about not using any global variables?

    "How would you communicate smartly between an ISR and the main without a global variable."

    Oh, that's easy. Loop back some port pins.

Reply
  • "Who said anything about all the variables ?"

    I think you know who it was: me.

    "I do, of course, use lots of local variables"

    Ok, ask yourself why you made those variables local rather than global.

    "what I reacted to is the idiotic C thing that some teach "under penalty of severe bodily harm, do not use any global variables""

    Who said anything about not using any global variables?

    "How would you communicate smartly between an ISR and the main without a global variable."

    Oh, that's easy. Loop back some port pins.

Children