title: Passing in and setting global int through main
body: <p>I've been trying to create a tester for my Stack ADT, by dynamically passing in the amount of items to add to the stack. However, when I try passing in an integer, for instance, 22, it assigns the global variable (ITEMS) as 50. If I try something else, the range is between 45, and 55.</p>
  
  <p>My main function is this:</p>
  
  <pre><code>int main(int numArgs, char* numItems[]) {
      Stack stack;
  
      if (numArgs == 0) {
          printf("Good job, you broke C.\n");
      } else if (numArgs == 2) {
          int items = (int)*numItems[1];
          if(*numItems[1] != ITEMS) {
              setItems(items);
          } 
      } else if (numArgs&gt;=3) {
          printf("Usage: TestStack &lt;numItems&gt; &lt;-help&gt;\n");
          exit(1);
      } else if(numItems[1] == "-h" || numItems[2] == "-help") {
          printf("numItems   - Number of items to add to the stack.\n            -h     (-help) -  Shows this help output.\n");
          exit(1);
      }
      /* test code here*/
  }
  </code></pre>
  
  <p>The assignment function is: </p>
  
  <pre><code>static void setItems(int numItems) {
      ITEMS = numItems;
      printf("ITEMS IS %d\n",ITEMS);
  }
  </code></pre>
  
  <p>And my global variable is just </p>
  
  <pre><code>int ITEMS = 11; //Default value.
  </code></pre>
  
  <p>Any reason that I can't actually get the real value I'm trying to pass in?</p>