Fastest way to set all values of an array?

后端 未结 14 2281
悲哀的现实
悲哀的现实 2020-12-04 17:47

I have a char [], and I want to set the value of every index to the same char value.
There is the obvious way to do it (iteration):

<         


        
14条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 18:00

    If you have another array of char, char[] b and you want to replace c with b, you can use c=b.clone();.

提交回复
热议问题