title: Pointers in C Programming- Coordinate conversion
body: <p>I should write a program to convert Cartesian coordinates to Polar and vice versa with use of pointers, I wrote the following code but my function gives me segmentation fault. I tried to do it without the pointers and still it doesn't send my numbers to the function, can someone help to modify my pointer code? I'm new with C.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  void cart(float *radius,float *degree)
  {
      float *x,*y,*radians;
      *radians= (3.14159265359/180) * *degree;
      *x= *radius * cos(*radians); 
      *y= *radius * sin(*radians);
  }
  
  int main()
  {
      float radius, radians, degree;
      float x,y;
      int M;
      char C,P;
      printf(" Enter C if you are converting Cartesian to Polar \n"); 
      printf(" Enter P if you are converting Polar to Cartesian \n");
      scanf("%c",&amp;M);
  
      if (M=='P')
      {
          printf("Enter the Radius and Angle separated by comma \n");
          scanf("%f,%f",&amp;radius,&amp;degree);
          cart(&amp;radius,&amp;degree);
          printf("Cartesian form is (%f,%f) \n",x,y);
      }
      else if (M=='C')
      {
          printf("Enter values of X and Y separated by comma \n");
          scanf("%f,%f",&amp;x,&amp;y);
          radius=sqrt(((x*x)+(y*y))); // finding radius 
          radians=atan(y/x); //finding angle in radians
          printf("Polar form is (%f,%f) \n",radius,radians); //angle is in radians
      }
  
      return 0;
  }
  </code></pre>