Question for strcpy and pointer

  • Thread starter Linda8888
  • Start date
  • #1
Linda8888
7
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
 

Answers and Replies

Suggested for: Question for strcpy and pointer

  • Last Post
Replies
17
Views
739
  • Last Post
Replies
2
Views
49
  • Last Post
Replies
3
Views
513
Comp Sci MPLS question
  • Last Post
Replies
1
Views
298
Replies
5
Views
781
Replies
2
Views
544
  • Last Post
Replies
3
Views
523
Replies
7
Views
509
Replies
16
Views
337
Top