C语言大佬救救我啊,指针问题

怎么用指针啊?不能用[……]. ta定义了一个score[3][3],要求输入n,输出score[n][0~3],调用函数search(score,n),必须要用指针,不能用到[……]

#include<stdio.h>

int main() {
    
    // 怎么用指针啊?不能用[……]. ta定义了一个score[3][3],要求输入n,输出score[n][0~3],调用函数search(score,n),必须要用指针,不能用到[……]
    int score[3][3] = { {91, 92, 93},
                        {81, 82, 83},
                        {71, 72, 73}};
    int n;
    
    printf("Please enter n (0 ~ 2): ");
    scanf("%d", &n);
    
    if (0 <= n && n < 3) {
        int (*p)[3] = score + n;
        int *q = *p;
        
        for (int * q = *p; q < *p + 3; ++q) {
            printf("%d ", *q);
        }
    }
    else {
        printf("%d is out of range 0 ~ 2)!", n);
    }
    
    return 0;
}




// Output:
Please enter n: 0
91 92 93 

Please enter n: 1
81 82 83 

Please enter n: 2
71 72 73 

Please enter n (0 ~ 2): 3
3 is out of range 0 ~ 2)!

 

你这题目再改改

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632