Код: Выделить всё
+1Код: Выделить всё
char *Код: Выделить всё
int main()
{
const char *s = "this is string";
char *hello = malloc(strlen(s) + 1);
strcpy(hello, s);
char *world = malloc(strlen(s));
strcpy(world, s);
printf("Hello: %s\n", hello);
printf("World: %s\n", world);
return 0;
}
Код: Выделить всё
Hello: this is string
World: this is string
Код: Выделить всё
+1Код: Выделить всё
\0Код: Выделить всё
hello" и "worldПодробнее здесь: https://stackoverflow.com/questions/798 ... out-0-in-c
Мобильная версия