Hi,

I'm used to use global variables for some reasons:
1. I can use them for different functions, unless I don't want to share the values inside them, then I would declare other variables.
2. Easier to track values in other functions; if I wanted to.

But using static local variables is rather a new method to me and one member of Arduino forum provided me with a code that uses static local variables and I asked him why? and he told me that if I want to keep track of that variable.

I tested it on codeblcoks and yes it's true that if I call the function multiple times with declaring the variables as static, I would keep track of the values, otherwise it would be the same and I can't change it.


So, my questions are:
1. What is the advantages / disadvantages of using static local variables ?

2. Same question with global variables.

3. What if I used static with a global variables ? Is it the scope to only that library ?