title: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] qt1.function = &H1
body: <p>I doing integration of a complex function using gsl library in C programming language. In this code I had to declare two variables using pointer that I have done successfully. But I am facing a problem when I pass these variables in main function.</p>
  
  <p>Please help me out.</p>
  
  <p>My code is being written here:</p>
  
  <pre><code>struct har{
  
  double t;
  double k;
  double x;
  };
  
  #include"str.h"
  struct har H1( void  * params, float q , int p )
  
      {
  
      struct har  *p_params = (void *)params;
  
  
      float  mu=2;
      double x =p_params -&gt;x ;
      double t = p_params -&gt; t;
      double  k = p_params -&gt; k;
      //printf("%d",k);
      struct har  H1 =  {x*cos(t*x)/(pow((mu*t*k),2)+pow(x,2))};
      return H1;
      }
  
  
   double H (double x,void * params )
  {
  double e;
  double t = *(double *) params;
  //printf("%f\n",t);
  //struct har t1,z;
  //double t = z.params -&gt;t1;
  double H  = (pow(e,-x)/x) ;//I(x,&amp;t)*(sin(x*t));  
  return H;
  }
  
  
  #include&lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;gsl/gsl_integration.h&gt;
  #include"H.h"
  #include"H1.h"
  
  int
  main (void)
  {
    gsl_integration_workspace * w
      = gsl_integration_workspace_alloc (10000);
  
    struct har t,k;
  
    double x, qtr, qbartr, qdottr, qddotr,q7r, qatr, qbtr, qt1r, error;
    double expected = -4.0;
    double a1 = 1e-14;
    double a= 150;//150;
    double pi = 3.141;
    double b = 1.05263;
    double mu = (2*pi)/b;
    double q0=0;
    double p0=6.5;
    double om=7.07;
    double tau=0.141;
    double gamma = 0.180;
  
  for(int m=2; m&lt;4; m++)
  {
  
  
   float  t = 4.14937*(m-1);
  
  
   gsl_function qt;
   qt.function = &amp;H;
   qt.params =&amp;t;
   gsl_integration_qags (&amp;qt, a1, a, 0,1e-7, 10000, w, &amp;qtr, &amp;error);
  // printf ("qtresult = % .18f\n\n", qtr);
  
   for(int k=1; k&lt;=2; k++)
      {
        {
  struct har item = {x,t,k};
  struct har *p_params = &amp;item;
  
  
         double  gama=gamma/((mu*k*tau)+1);
  //      printf("gama = % .18f\n", gama);
  
         gsl_function qt1;
  
         qt1.function = &amp;H1;
         qt1.params = &amp;p_params;
      // qt1.params = &amp;k;
         gsl_integration_qags (&amp;qt1, a1, a, 0,1e-7, 10000, w, &amp;qt1r, &amp;error);
        printf("qt1result= % .18f\n", qt1r);
  
  
       }
  
  }
  
  
    gsl_integration_workspace_free (w);
  
    return 0;
  }
  </code></pre>
  
  <p>In above code I had four file by namely code.c, str.h, H1.h and H.h. Where H1 and H contains two user defined functions and str is a file for structure and code.c is my main to compile.</p>
  
  <p>Thanks for your time and observation.</p>
  
  <p>Regards </p>
  
  <p>Ramesh  </p>