Variable masses (VLA) are... ?


  • QA Engineer

    I'm writing a program that sorts words in the line. The mission says:

    The use of AC ranges (VLA) is prohibited.

    If anything, I'll write to the SI.

    I don't quite understand what VLA means. It's like malloc and stuff? Or something else?

    Thank you very much.



  • It's when you write something like that.

    int n;
    scanf("%d",&n);
    int a[n];
    

    That is, a mass declared as a mass, but the size of which is determined during work rather than during the compilation.

    C malloc - It's a little different, it's a dynamic remembrance for the mass:

    int n;
    scanf("%d",&n);
    int *a = malloc(n*sizeof(int));
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2