Hi,
I am trying to write a program that asks for a string, enters it into array1, and then copies it into array2, which is empty. The program then displays array1 and array2. The problem is that I can't seem to get the first array to enter into the second. Im trying to do this using just pointers with arrays. I don't know any of the string functions yet, like strncpy() or similar ones. The section in red is where I try to copy array1 to array2. Probably makes no sense, but I'm stuck. Any help would be appreciated.Code:#include <stdio.h> main() { char string1[51], string2[51], *letter, *letter2; printf("\nPlease enter a string: "); gets(string1); /*PRINT STRING1*/ for(letter = string1; *letter != '\0'; ++letter) printf("%c" , *letter); /*ASSIGN STRING1 TO STRING2*/ for(letter2 = string2; *letter2 != '\0'; ++letter2) string2[*letter2] = *letter; putchar('\n'); /*PRINT STRING2*/ for(letter2 = string2; *letter2 != '\0'; ++letter2) printf("%c" , *letter2); }