May I initialize a global variable with the result of a function call?

Viewed 4986

Is the following code legal?

int add(int a, int b) { return a + b; }

int some_global_variable = add(1, 2);

int main() { /* ... */ }
1 Answers
Related