title: Problem with finding the length of a string using pointers in a function in c
body: <p>I got a task from my college which is to find the length of a string using pointers in a function.Here is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define max 100
  
  int lengthchar(char *array1[])
  {
      int a, x = 0;
      for (a = 0; *(array1++) != '\0'; a++)
      {
          x++;
      }
      return x;
  }
  
  int main()
  {
      char arr1[max];
      int length;
  
      printf("Enter string\n");
      gets(arr1);
  
      length = lengthchar(arr1);
  
      printf("Length=%d", length);
  
      return 0;
  }
  </code></pre>
  
  <p>But when I  give input something bellow:</p>
  
  <p>Enter string: av</p>
  
  <p>Length=9</p>
  
  <p>It shows the wrong length, what's my mistake?</p>