CodePudding user response:
Int a [10]={0}; Such initialization is possible, but only a [0] is initialized to zero, the main problem is that your code int a [k], array declaration, length should be a constant, should not be you calculated the runtime variables,CodePudding user response:
A is not sure about the size of an array, the size is determined by n, C language does not support an array variable, the original poster can use dynamic application space form the application space (as an array)a=(int *) malloc (sizeof (int) * k);
if (! A)
The exit (0);
Memset (a, 0, k * sizeof (int));