How to initialize all members of an array to the same value?

后端 未结 23 1822
清歌不尽
清歌不尽 2020-11-21 04:34

I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value.

I could swear I

23条回答
  •  情书的邮戳
    2020-11-21 05:20

    A slightly tongue-in-cheek answer; write the statement

    array = initial_value
    

    in your favourite array-capable language (mine is Fortran, but there are many others), and link it to your C code. You'd probably want to wrap it up to be an external function.

提交回复
热议问题