+ 1

strcpy problem

what is my mistake? I want to copy "Copy" to my strings list but it doesn't work! https://code.sololearn.com/cA4a5A18a2A2/#c

2nd Jan 2021, 2:23 PM
GHOST mHBr
GHOST mHBr - avatar
2 Respuestas
+ 1
you are mixing arrays with pointers. and in C this is not a list but an array. correct way could be: #include <stdio.h> #include <string.h> int main() { char message[10][10] = { "Hello!" ,"Good Bye!","1202","15","14","16"}; printf("%s\n",message[0]); strcpy(message[0], "Copy"); printf("%s\n", message[0]); return 0; }
2nd Jan 2021, 2:53 PM
Flash
0
thank you a lot Flash
2nd Jan 2021, 2:57 PM
GHOST mHBr
GHOST mHBr - avatar