This throws an error id returned 1 error status. The loop is working but I cant print the final concatenated string. When i try to print the final string it does nothing.
char str1[50], str2[50], str[100];
char *p1, *p2, *p3;
int i = 0, j = 0;
p1 = &str1[0];
p2 = &str2[0];
p3 = &str[0];
printf("enter a string:");
gets(str1);
printf("enter a string:");
gets(str2);
while (i <= strlen(str1) + strlen(str2)) {
if (i != strlen(str1)) {
*(p3 + i) = *(p1 + i);
i++;
} else {
*(p3 + i) = *(p2 + j);
j++;
}