Global variables

Declaring a variable outside a function makes it a global variable.

#include <stdint.h>

int32_t NUM;

Intention to program without using global variables

And from here, I will explain the programming method that does not use global variables steadily without explaining global variables.

All you need to do is understand the dangers of global variables and never use them.

"If you change it somewhere, you won't know where the bug is. I don't like that !!!"

If you lose this intention, you will write global variables. You can write any programming without global variables.

If you stick to that intention thoroughly, you can practice programming that does not use global variables.

If it's a special situation, really, really, really, if this is a special situation and you need a global variable, ask yourself more than 100 times.

Associated Information