我会从 ISBN 字符串中删除“-”。但是我的代码不会打印出我的价值。错在哪里?
char *ISBN[20]; //example: 3-423-62167-2
*p = ISBN;
strcpy(ISBN, ptr); //Copy from a Buffer
printf("\nISBN Array: %s", ISBN); //This works!
while(*p)
{
if (isdigit(*p))
{
long val = strtol(p, &p, 10);
printf("%ld\n", val); //Do not show anything!
}
else
{
p++;
}
}