What is the safe way to fill multidimensional array using std::fill?

前端 未结 5 1840
终归单人心
终归单人心 2020-11-30 04:40

Here is what I am using:

class something
{
   char flags[26][80];
} a;

std::fill(&a.flags[0][0], &a.flags[0][0] + 26 * 80, 0);

(Upda

5条回答
  •  情深已故
    2020-11-30 04:47

    char flags[26][80];
    std::fill((char*)flags, (char*)flags + sizeof(flags)/sizeof(char), 0);
    

提交回复
热议问题