Here is a C program in textbook, it asks a 3*5 2D array from users and prints the third line.
I am confused with int* p[5]. Why here needs to have [5], I think just int* p is OK. It can repeatedly add and point to the next memory space in the int array. And can anyone explain how pointer works in this program?
#include <stdio.h>
int main(void){
        int a[3][5];
        int i,j;
        int *p[5];
        p = &a[0];
        printf("Please input:\n");
        for(i = 0; i < 3; i++){
                for(j = 0; j<5;j++){
                        scanf("%d\n",(*(p+i))+j);
                }
        }
        p = &a[2];
        printf("the third line is:\n");
        for(j = 0; j<5; j++){
                printf("%5d", *((*p)+j));
        }
        printf("\n");
}
 
     
    