I'm having trouble copying string in C, this does not want to work.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int count;
char str1[20] = "Hello World", str2[20];
for(count = 0; str1[count]!='#include <stdio.h>
#include <stdlib.h>
int main()
{
int count;
char str1[20] = "Hello World", str2[20];
for(count = 0; str1[count]!='%pre%'; count++)
str2[count] = str1[count];
str2[count] = '%pre%';
printf("%c%", str2[count]);
system("pause");
return 0;
}
'; count++)
str2[count] = str1[count];
str2[count] = '%pre%';
printf("%c%", str2[count]);
system("pause");
return 0;
}
I have tried with% c, and% s, and with braces in, but nothing appears on the screen,% s appears (null), I know there is the option to use strcpy.