title: How to print argv arguments from main function in C?
body: <p>So I just learnt that we can give two arguments into main function namely "argc" and "argv. However I am not able to understand what argv is in this:
  <code>int main(int argc, char* argv[]);</code> </p>
  
  <p>Is argv an array of characters? or is it an array of pointers pointing to characters? Either way I am looking for a way to print out the arguments that the user passes to this program. This is the code the I wrote, but it's not printing the argv's so to speak. What's wrong in it? I guess it's my understanding of argv that's making this code incorrect. </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main(int argc, char *argv[])
  {
      int i;
      printf("%d\n",argc);
      for(i=0;i&lt;argc-1;i++)
      {
          printf("%s",*argv[i]);
      }
      return 0;
  }
  </code></pre>
  
  <p>After the suggestions that I got from answers, I corrected my code as follows.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main(int argc, char *argv[])
  {
      int i;
      printf("%d\n",argc);
      for(i=1;i&lt;argc;i++)
      {
          printf("%s",argv[i]);
      }
      return 0;
  }
  </code></pre>
  
  <p>And I am using Ubuntu Linux in VMWare on my windows 8.1 pc. This is the output that I am getting. It's just printing argc and after that nothing. What's the problem? Is it the way I am compiling it or something in Linux terminal?</p>
  
  <p><a href="https://i.stack.imgur.com/XCKhM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XCKhM.png" alt="The snapshot of my terminal"></a></p>
  
  <p>In the above figure, I want the numbers 2,4,5,3 to be printed again, but they are not getting printed. </p>
  
  <p>Thanks.</p>