title: Swap two pointers using XOR
body: <p>I have a quick question about using XOR two swap two string literals. </p>
  
  <p>so I have the following: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  
  void intSwap(int *a, int *b){
      *a=*a^*b;
      *b=*a^*b;
      *a=*a^*b;
  }
  
  
  void swapString(char **a, char **b){
      char *temp=*a;
      *a=*b;
      *b=temp;
  }
  
  void main(){
      char *s= "ha";
      char *t= "Oh";
  
      printf("%s and %s \n",s,t); // prints ha Oh
      swapString(&amp;s,&amp;t);
      printf("%s and %s \n",s,t); // prints Oh ha
  
  
      int a=10;
      int b=5;
      printf("%d %d\n",a,b); //print 10 5
      intSwap(&amp;a,&amp;b);
      printf("%d %d\n",a,b); //print 5 10
  }
  </code></pre>
  
  <p>As you can see, I used binary operation XOR to for the intSwap. However, when I tried to do the same thing with swapString, it's not working. </p>
  
  <p>I get error message saying: invalid operands to binary ^ (have ‘char *’ and ‘char *’)</p>
  
  <p>Do you know how to use XOR to swap two string literals? Is it possible in C? Thanks ahead!!</p>