title: Longest string in an array of strings in C++
body: <p>I was trying to get the maximum length of a string from an array of strings.</p>
  
  <p>I wrote this code:</p>
  
  <pre><code>char a[100][100] = {"solol","a","1234567","123","1234"};
  int max = -1;
  for(int i=0;i&lt;5;i++)
      if(max&lt;strlen(a[i]))
      max=strlen(a[i]);
  cout&lt;&lt;max;
  </code></pre>
  
  <p>The output it gives is -1.
  But when I initialize the value of max by 0 instead of 1, the code works fine. Why is it so?</p>