while(*ptra!='\0'){
ptra=ptrb;
printf("%c",*ptra);
if(*ptra || *ptrb=='\0')
break;
ptra++;
ptrb++;
}
The instruction ptra=ptrb sets the two pointers to the same value. After that it can only go wrong.
As Palini and Richard had already written, the recognition of the string end is also wrong afterwards and the usual swap does not take place at all.
For swap you can write a function, or use this if the compiler offers it.
Based on the original code, it might then look like this:
for ( ptra = a, ptrb = b; *ptra || *ptrb; ++ptra, ++ptrb) {
swap(ptra, ptrb);
}
*ptra = '\0';
*ptrb = '\0';
The length of the strings and the temporary string are not needed, the code is useless.
As you can see, the code assumes that both strings are the same length. If not, the longer one will be shortened. It might make sense to check this before the swap and abort if necessary.