title: Warning: Assignment from Incompatible Pointer Type [enabled by default] while assigning Function Address to Function Pointer
body: <p>I am trying to implement a simple swap function using function pointer but when I assign the function's address to a function pointer:</p>
  
  <p>`pointersTofunctionB.c:14:6:warning: assignment from incompatible pointer type [enabled by default]. </p>
  
  <p>This is my code: </p>
  
  <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt;
  void intSwap(int *a,int *b);
  void charSwap(char *a,char *b);
  void (*swap)(void*,void*);
  int main(int argc, char const *argv[])
  {
      int a=20,b=15;
      char c='j',d='H';
      swap=&amp;intSwap;// warning here
      swap(&amp;a,&amp;b);
      printf("%d %d\n",a,b);
      swap=&amp;charSwap;// warning here also
      swap(&amp;c,&amp;d);
      printf("%c %c\n",c,d ); 
      return 0;
  }
  
  
  void intSwap(int *a,int *b)
  {
      *a=*a+*b;
      *b=*a-*b;
      *a=*a-*b;
  }
  void charSwap(char *a,char *b)
  {
      char temp;
      temp=*a;
      *a=*b;
      *b=temp;
  }
  </code></pre>
  
  <p>How can I solve this warning?</p>