title: Command line argument to string in C
body: <p>Is there a way in C to store the whole command line options and arguments in a single string. I mean if my command line is <code>./a.out -n 67 89 78 -i 9</code> then a string <code>str</code> should be able to print the whole command line. Now, what I am able to do is to print values in different vector forms.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;getopt.h&gt;
  #include &lt;string.h&gt;
  
  
  int main(int argc, char* argv[]) {
   int opt;
  
  for(i=0;i&lt;argc;i++){
  printf("whole argv was %s\n", argv[i]);
  }
  
  while((opt = getopt(argc, argv, "n:i")) != -1) {
  switch (opt){
      case 'n':
               printf("i was %s\n", optarg);
               break;
  
      case 'i':
               printf("i was %s\n", optarg);
               break;
        }
     }
    return 0;
   }
  </code></pre>
  
  <p>I want this, as <code>optarg</code> only is printing my first argument and I want all the arguments to be printed, so I want to parse it after storing it in string.</p>