0
I’m having trouble copying string in C, it doesn’t 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]!='\0'; count++)
str2[count] = str1[count];
str2[count] = '\0';
printf("%c%", str2[count]);
system("pause");
return 0;
}
I have tried with %c, and %s, and with keys no for, but nothing appears on the screen, %appears (null), I know there is the option to use strcpy.
You don’t need the [Count]?
– user25158
str2[count]
is a character, specifically the'\0'
that you just put in.– pmg