通过循环打印数组元素时指向旧地址的指针

Pointer pointing older address while printing the array elements through loop

我想通过另一个用户定义的函数读取 main 函数中定义的数组元素。该数组是二维的,它正确显示了前三个元素,但随着下一个循环开始,该指针指向的地址从预期地址后退了 2 步。为什么? 这是调用 frame() 函数的主要函数,问题在于:

void main(){
    char dec,player[2][20];
    int i,counter=0,palo,winner=0;
    for(i=0;i<2;i++){
        printf("Enter Player%d's name: ",(i+1));
        scanf("%s",player[i]);                  //ASK PLAYER NAME
    }
    startAgain:                             //GAME RESTART POINT
    system("cls");
    palo=0;
    char spot[][3]={"123","456","789"};

    //------------------MAIN GAME AREA-------------------------------
    for(counter=0;counter<9;counter++,palo++){
        frame(*spot);
        read(&palo,*spot,*player);
        palo %=2;
    }
}

这是 frame() 函数:

void frame(char *count){
    int i,j;
    printf("\t\t\t");
    line(24);
    for (i = 0; i < 3; i++){
        printf("\t\t\t");
        for (j = 0; j < 3; j++){
            printf("|   %c   ",(*(count+i)+j));
        }
        printf("|\n\t\t\t");
        line(24);
    }
}

预期的输出是:

1        2       3
4        5       6
7        8       9

它显示的内容:

1        2       3
2        3       4
3        4       5

让自己和他人的生活更轻松,使用普通数组索引而不是指针算法。

    for(counter=0;counter<9;counter++,palo++){
        frame(spot);
        read(&palo,spot,player);
        palo %=2;
    }

...
void frame(char count[][3]){
    int i,j;
    printf("\t\t\t");
    line(24);
    for (i = 0; i < 3; i++){
        printf("\t\t\t");
        for (j = 0; j < 3; j++){
            printf("|   %c   ",count[i][j]);
        }
        printf("|\n\t\t\t");
        line(24);
    }
}