Quickest way to initialize an array of structures to all-0's?

后端 未结 7 654
无人及你
无人及你 2020-12-14 16:49

I\'m trying to initialize an array of structures to all-0\'s, using the below syntax:

STRUCTA array[MAX] = {0};

However, I\'m getting the f

7条回答
  •  孤街浪徒
    2020-12-14 17:34

    It depends on the STRUCTA. For example :

    typedef struct structa 
    {
        int a, b;
    } STRUCTA;
    
    int main (int argc, char const* argv[])
    {
        STRUCTA array[10] = {{0,0}};
        return 0;
    }
    

提交回复
热议问题