title: strcmp() returns 10 when I compare the exact same string in C
body: <p>I am building a basic shell program, and and using a while loop to continually prompt the user and they can put in commands to run. When the user inputs 'exit' I want my shell program to terminate. I use fgets to get the user input, and parse it out into an array <code>cmdArr</code> using strtok.</p>
  
  <pre><code>int j = 0;
  char **cmdArr;
  char inputsp[128];
  char *cmds;
  
  printf("==&gt;");
  fgets(inputs, 128, stdin);
  cmds = strtok(inputs, " ");
  while (j&lt;1) {
  
      i = 0;
      while (cmds != NULL) {
          cmdArr[i] = cmds;
          cmds = strtok(NULL, " ");
          i++;
      }
  
      if (strcmp(cmdArr[0], "exit") == 0) {
          printf("exit command passed\n");
          exit(0);
      }
      else {
          printf("==&gt;");
          fgets(inputs, 128, stdin);
          cmds = strtok(inputs, " ");
     }
  }
  </code></pre>
  
  <p>When I type in exit, I have confirmed that cmdArr[0] stores the string "exit" by <code>printf</code>ing cmdArr[0]. When I print out the value of <code>strcmp(cmdArr[0], "exit")</code> I always get the value as 10, and I'm nore entirely sure why. I believe they are the same two string, so <code>strcmp</code> should be returning 0 correct?</p>