Initializing Primitive Array to One Value

前端 未结 6 1367
暗喜
暗喜 2021-01-18 03:55

Is there a way to initialize an array of primitives, say a integer array, to 0? Without using a for loop? Looking for concise code that doesn\'t involve a for loop.

6条回答
  •  萌比男神i
    2021-01-18 04:27

    double A[10] = { value }; // initialize A to value. I do not remember if value has to be compiled constant or not. will not work with automatic arrays

提交回复
热议问题