Declaring an array of unknown size

后端 未结 4 1280
一向
一向 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:45

    Normally when creating an array you need to know the size before-hand. Whether you know the value at compile-time or run-time can be dependent on your language/project requirements, but it must be known before you can decide to create an array of that size. (i.e. the first solution is correct)

提交回复
热议问题