title: Why do I get this unexpected result using atoi() in C?
body: <p>I don't understand the results of the following C code.</p>
  
  <pre><code>main()
  {
      char s[] = "AAA";
      advanceString(s);
  }
  
  void advanceString(p[3])
  {
      int val = atoi(p);
      printf("The atoi val is %d\n",val);
  }
  </code></pre>
  
  <p>Here the <code>atoi</code> value is shown as 0, but I could not figure out the exact reason.
  As per my understanding, it should be the summation of decimal equivalent of each values in the array? Please correct me if I am wrong.</p>