Concatenate two strings using pointer in C program

In this program, you will take two strings from the user and Concatenating those strings using a pointer

#include<stdio.h>
int main()
{
    char a1[20],a2[20],c[30];
    int i,j;
    char *p1,*p2,*p3;
    p3=c;
    p1=a1;
    p2=a2;
    printf("enter first string:");
    gets(p1);
    printf("enter second string:");
    gets(p2);
    for(i=0;*(p1+i)!='\0';i++)
    {
      *(p3+i)=*(p1+i);
    }
    for(j=0;*(p2+j)!='\0';j++,i++)
    { 
       *(p3+i)=*(p2+j);
    }
    *(p3+i)='\0';
    printf("after concating two string: %s",p3);
    return 0;
}

output

enter first string:gaurav
enter second string:prajapati
after concating two string: gaurav prajapati