同时也是为了理解指针的指针,所以写了如下程序并调试之。
#include <stdio.h>
int is_digit(char c) ;
int main (int argc, char *argv[]) {
int i;
for (i = 0; i < argc; i++)
printf ("%s\n", *argv++);
char *str = "65535";
char **s;
s = &str;
i = 0;
while (is_digit(**s)) {
i = i * 10 + *((*s)++) - '0';
}
printf ("\n");
printf ("%d\t %x\n", i, i);
}
int is_digit(char c) {
if (c >= '0' && c <= '9') {
return 1;
} else {
return 0;
}
}