title: Passing a integer through command line in C?
body: <p>I was wondering if someone could explain how passing arguments through command line works? I'm really confused by how it works. Right now I'm trying to pass one integer into the main program. How would I go about doing this? </p>
  
  <p>EDIT: keep getting the initialization makes integer from pointer without a cast [-Wint-conversion] error? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define PI 3.1416
  int
  main (int argc, char *argv[])
  
  { 
    double r,area, circ;
  
    char a = argv[1];
    int num =  a - '0';
  
    printf("You have entered %d",num); 
  
    r= num/2;
    area = PI * r * r;
    circ= 2 * PI * r;
  
    printf ("A circle with a diameter of %d ", num);
    printf ("has an area of %5.3lf cm2\n", area);
    printf ("and a circumference of %4.2lf cm.\n", circ);
  
    return (0);
  
  }
  </code></pre>