Usage of atoi in the c language

Posted by maddy on Stack Overflow See other posts from Stack Overflow or by maddy
Published on 2010-04-28T12:44:49Z Indexed on 2010/04/28 13:03 UTC
Read the original article Hit count: 237

Filed under:
|

I don't understand the results of the following C code.

main()
{
   char s[] = "AAA";
   advanceString(s);
}

void advanceString(p[3])
{
     int val = atoi(p);
     printf("The atoi val is %d\n",val);
}

Here the atoi val 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.

© Stack Overflow or respective owner

Related posts about c

    Related posts about atoi