fork(1) download
  1. #include<stdio.h>
  2. void fun1(char* s1, char* s2){
  3. char* temp;
  4. temp = s1;
  5. s1 = s2;
  6. s2 = temp;
  7. }
  8. void fun2(char* s1, char* s2){
  9. char* temp;
  10. temp = *s1;
  11. *s1 = *s2;
  12. *s2 = temp;
  13. }
  14. int main(){
  15. char *str1="Hi", *str2 = "Bye";
  16. fun1(str1, str2); printf("%s %s", str1, str2);
  17. fun2(&str1, &str2); printf("%s %s", str1, str2);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5532KB
stdin
Standard input is empty
stdout
Hi ByeBye Hi