The problem is about taking input of a 4X5 matrix and shifting each of its rows circularly left by 2 places. Like if input is {1,2,3,4,5} the output should be {3,4,5,1,2}. I wrote the following code for the same. But I am getting 'segmentation fault(core dumped)' error. Can you help me with this. Also I am a bit susceptible about sending a 2-d array to function with **p argument. DO COMMENT ON THIS ALSO. I want to know why I am getting the error.
#include <stdio.h>
void shift(int **);
int main()
{
    int i,j,a[4][5];
    printf("Enter the elements of the 4X5 matrix:\n");
    for(i=0;i<4;i++)
    {
        for(j=0;j<5;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    printf("Entered Matrix:\n");
    for(i=0;i<4;i++)
    {
        for(j=0;j<5;j++)
        {
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }
    printf("\n");
        shift(a);
        printf("The new array is:\n");
    for(i=0;i<4;i++)
    {
        for(j=0;j<5;j++)
        {
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }
    printf("\n");
    return 0;
}
void shift(int **p)
{
    int i;
    for(i=0;i<4;i++)
    {
        int temp[2] = {**(p+i),*(*(p+i)+1)};
        *(*(p+i)+0) = *(*(p+i)+2);
        *(*(p+i)+1) = *(*(p+i)+3);
        *(*(p+i)+2) = *(*(p+i)+4);
        *(*(p+i)+3) = temp[0];
        *(*(p+i)+4) = temp[1];
    }
}
Expected Result - Rotated Array Actual Result - Segmentation Fault(Core Dumped)