Question for strcpy and pointer

  • Thread starter Linda8888
  • Start date
1 reply · 1K views · last reply
Linda8888
Messages
7
Reaction score
1
Summary:: Question: In the blank space below, write a new version of the first line of this code segment such that the strcpy succeeds. Use only stack memory and try not to waste memory.

how can I change the first line of the code?

Code:
char *s1;       // change this line
char *s2 = "good luck";
strcpy(s1, s2); // I must succeed