Operation on … may be undefined?

前端 未结 3 1264
抹茶落季
抹茶落季 2021-02-02 06:21

I have the following code

FRAME frameArray[5][10]; // Create the array of frames
int trackBufferFull[5] = {0, 0, 0, 0, 0};// Keeps track of how full the buffer f         


        
3条回答
  •  借酒劲吻你
    2021-02-02 07:03

    You're modifying trackTail[nodeNumber - 1] between sequence points. It's like you're assigning

    i = ++i;
    

    which is also undefined behaviour.

    Change your code to something like this:

    trackTail[nodeNumber - 1] = (trackTail[nodeNumber - 1] + 1) % 10;
    

提交回复
热议问题