I want to declare a global array and then use it in a few functions. When I want to assign any number to that array I face with this error:
Code:a.c:11:6: error: expected expression before ‘]’ token n[]={1,2,3,4,5}; ^
The code is:
Any help is appriciated. ThanksCode:#include <stdio.h> int n[5]; // I need to define the array here to be global int main () { n[]={1,2,3,4,5}; for (int i = 0; i < 5; i++) printf("n[%d] = %d\n", i, n[i]); return 0; }