0

error: variable-sized object may not be initialized

** the problem is when I put size between two Brackets it gives me an error but when I put 10 its works successfully, also I tried to use const int size but it doesn't work. **

this is the following code :


    int main(){
       int size = 10;
       int array[size]={35,9,41,22,11,80,7,3,6,4};
        for (int d=0;d<size;d++)
        {
          printf ("%d\t\n",array[d]);
        }
    }
Mahi
  • 1,019
  • 9
  • 19
Atrox
  • 107
  • 1
  • 6

0 Answers0