initializing an array of ints

前端 未结 7 830
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 05:00

Does anyone have a way to initialize an array of ints (any multi-byte type is fine really), to a non-zero and non -1 value simply? By which I mean, is there a w

相关标签:
7条回答
  • 2020-11-29 05:56

    You said something about 2 lines but you can do it in one line using comma ,operator.

    for(count = 0; count < 30 ; arr[count] = 1,count++);
    
    0 讨论(0)
提交回复
热议问题