First of all,
If you have assigned your character pointer as below,
char *p="India";
Then, In that case It is not possible to change the value of *p,
Below is not possible,
p[0]='U';
You can make your pointer to point somewhere else but you can not change value of its.
Now, Coming back to you question,
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
main()
{
char *p;
char t[10]="USA",temp[10];
p=(char*)malloc(sizeof(char)*10);
if(p==NULL)
{
perror("Malloc Failed : ");
return;
}
strcpy(p,"India");
printf("p = %s\n",p);
printf("t = %s\n",t);
strcpy(temp,t);
strcpy(t,p);
strcpy(p,temp);
printf("After swapping\n");
printf("p = %s\n",p);
printf("t = %s\n",t);
}