title: How to specify command line arguments for my C program when running it from the Eclipse IDE
body: <p>I have some code that is executed from the command line. It takes 3 parameters: </p>
  
  <pre><code>"example.txt" 3 s
  </code></pre>
  
  <p>I want to be able to run this program from inside of my Eclipse IDE instead of running it from the command line but I do not know how to assign the parameters without creating bugs int the program.</p>
  
  <p>Here is the main method below:</p>
  
  <pre><code>int main(int argc, char **argv) {
  if (argc != 4) {
      fprintf(stderr, "Usage: %s &lt;input file&gt; &lt;num clusters&gt; "
              "&lt;linkage type&gt;\n", argv[0]);
      exit(1);
  } else {
      item_t *items = NULL;
      int num_items = process_input(&amp;items, argv[1]);
      set_linkage(argv[3][0]);
      if (num_items) {
          cluster_t *cluster = agglomerate(num_items, items);
          free(items);
  
          if (cluster) {
              fprintf(stdout, "CLUSTER HIERARCHY\n"
                      "--------------------\n");
              print_cluster(cluster);
  
              int k = atoi(argv[2]);
              fprintf(stdout, "\n\n%d CLUSTERS\n"
                      "--------------------\n", k);
              get_k_clusters(cluster, k);
              free_cluster(cluster);
          }
      }
  }
  return 0;
  }
  </code></pre>
  
  <p>I am using c++ and eclipse IDE.</p>