How to empty a char array?

后端 未结 13 1779
抹茶落季
抹茶落季 2021-01-29 19:33

Have an array of chars like char members[255]. How can I empty it completely without using a loop?

char members[255];

By \"empty\" I mean that

13条回答
  •  醉话见心
    2021-01-29 20:06

    members[0] = 0;
    

    is enough, given your requirements.

    Notice however this is not "emptying" the buffer. The memory is still allocated, valid character values may still exist in it, and so forth..

提交回复
热议问题