[ad_1]
Yes you can, why did you think you can’t? But if the value is 0 you can skip the initialization since static variables are automatically initialized to 0. Also, as @M.M commented here it’s mandatory that the value is a constant, you can’t assign the result of malloc() for instance.
There is no potential problem, and there is no reason to think that there would be a problem. Except integer overflow, in your code that’s pretty sure going to happen but it has nothing to do with the storage class of your variable.
[ad_2]
solved can you assign initial value to global static variable in C? [closed]