Declaring an array of unknown size

后端 未结 4 1313
一向
一向 2021-01-29 09:09

This is not specific to any programming language, the problem is \"find the index of a specified value in an array of n numbers.

Now my question is, in the code below ca

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-29 09:28

    Converted from a comment as suggested by Merlyn Morgan-Graham

    The way an array is declared depends on what language you use. If you are writing pseudo-code you can decide it yourself as long as it communicates the intent and the desired result.

    The array can be declared as array = [], int[] array = new int[], int array[], array = array(), ´array = {}` etc. In some languages you have to declare the size of the array beforehand and in some languages the arrays expand when needed

提交回复
热议问题