expected '=', ',', ';', 'asm' or '__attribute__' before '.' token

前端 未结 3 1169
借酒劲吻你
借酒劲吻你 2021-02-01 19:56

\"enterCould not able to solve this.. I am implementing a queue. After writing the complete code I

3条回答
  •  情书的邮戳
    2021-02-01 21:01

    Q.front = 0; is not a simple initializer, it is executable code; it cannot occur outside of a function. Use a proper initializer for Q.

    struct Queue Q = {0, 0};
    

    or with named initializer syntax (not available in all compilers, and as yet only in C):

    struct Queue Q = {.front = 0, .rear = 0};
    

提交回复
热议问题