I'm having trouble understanding the behavior of strtol()
in C. For example, when I'm testing the string " 4396"
, if I have:
char *test = " 4396";
char *ptr;
int result = strtol(test, &ptr, 10);
printf("%d\n", result);
printf("%d\n", strlen(ptr));
Output:
4396
//not 0
I'm just wondering about why the length isn't 0
, since I have checked to the end already?
Thank you for your help.