Reset C int array to zero : the fastest way?

前端 未结 7 1356
感情败类
感情败类 2020-12-22 18:34

Assuming that we have a T myarray[100] with T = int, unsigned int, long long int or unsigned long long int, what is the fastest way to reset all its content to

7条回答
  •  渐次进展
    2020-12-22 19:09

    For static declaration I think you could use:

    T myarray[100] = {0};
    

    For dynamic declaration I suggest the same way: memset

提交回复
热议问题