fork(1) download
  1. #include<stdio.h>
  2.  
  3. void strcp(char *s1, char *s2);
  4.  
  5. int main() {
  6.  
  7. char *s1 = "Hi, I am a good boy"; //1
  8. char *s2 = "Really!! I am a good boy"; //2
  9.  
  10. strcp(&s1,&s2);
  11.  
  12. printf("s1 = %s", s1);
  13. printf("\ns2 = %s", s2);
  14.  
  15. return 0;
  16. }
  17.  
  18. void strcp(char *s1, char *s2) {
  19. char *temp = *s1;
  20. *s1 = *s2;
  21. *s2 = temp;
  22. }
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
s1 = Really!! I am a good boy
s2 = Hi, I am a good boy