I've defined a function like this
static void
flatten_tree(...)
{
static int num = 0;
...
}
However, when the function is executed, num gets some random value, rather than 0 on the first run. Upon subsequent function calls it behaves as static var should do. Aren't static variables explicitly initialized with zero? What is the proper way to initialize it?