fork(1) download
  1. #include<stdio.h>
  2. void swap(char **str1, char **str2)
  3. {
  4. char **temp = str1;
  5. str1 = str2;
  6. str2 = temp;
  7. }
  8. int main()
  9. {
  10. char *str1 = "Gate";
  11. char *str2 = "Overflow";
  12. swap(&str1, &str2);
  13. printf("str1 is %s, str2 is %s", str1, str2);
  14. return 0;
  15. }
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
str1 is Gate, str2 is Overflow