I have made a strcpy()
function
in C, and I am copying words from one array to other not just letters, but when I run it I am getting Segmentation fault what to do?
#include <stdio.h>
void strcpy1(char *dest[], char source[])
{
while ((*dest++ = *source++));
}
int main()
{
char source[3][20] = { "I", "made", "this" };
char dest[3][20];
strcpy1(&dest, source);
//printing destination array contents
for (int i = 0; i < 3; i++) {
printf("%s\n", dest[i][20]);
}
return 0;
}