I have been writing C code for many years, but recently I came up with a function that I have never used: a static variable inside a function. So I was wondering how you used this feature, and it was the right design decision.
eg.
int count(){
static int n;
n = n + 1;
return n;
}
is a constructive solution to BAD. What for? because later on you may want to decrease the counter, which will include changing the parameters of the function, changing the entire calling code, ...
Hope this is clear enough, thanks!
source
share