Usage of atoi in the c language
- by maddy
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.