title: strlen function always returning 0
body: <p>For a homework assignment we have to write a short program that tells you the number of arguments passed to main, their data address, and what each argument is, using argc and argv.  We also had to write a function called strlen (we weren't allowed to use any similar functions included in a library) that computed the length of each argument passed to main by using pointers.  My function always returns 0.  Sorry that I am asking such a basic question, but as a first year student I am not trained in the use of a debugger yet. Here is my code:</p>
  
  <pre><code>int strlen(char * p)
  {
      char X[50];
      p = &amp;X[0];
      int i = 0;
  
      while (*(p + i) != '\0')
         i++;
  
      return i;
  }
  </code></pre>
  
  <p>I've tried several different things to fix this but no matter what the function always seems to return the value 0.  Is there a glaringly huge issue I am overlooking?  Any nudge in the right direction would be helpful, but please don't just give me the answer.</p>