Difference between int[] array and int array[]

前端 未结 25 2971
轻奢々
轻奢々 2020-11-21 07:18

I have recently been thinking about the difference between the two ways of defining an array:

  1. int[] array
  2. int array[]
  3. <
25条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-21 08:10

    There is no difference.

    I prefer the type[] name format at is is clear that the variable is an array (less looking around to find out what it is).

    EDIT:

    Oh wait there is a difference (I forgot because I never declare more than one variable at a time):

    int[] foo, bar; // both are arrays
    int foo[], bar; // foo is an array, bar is an int.
    

提交回复
热议问题