程序填空题:八进制字符串转换为十进制整数
以下程序的功能是将无符号八进制数字构成的字符串转换为十进制整数。例如输入的字符串为“556”,则输出十进制整数366。请填空。
```c++
#include
int main()
{
char *p, s[6];
int n;
p = s;
gets(p);
n = *p - '0';
while (@@[*(++p)](3) != '\0')
n = n * 8 + (*p) - '0';
printf("%d\n", n);
return 0;
}
```
答案:
第1空:*(++p)
```c++
#include
int main()
{
char *p, s[6];
int n;
p = s;
gets(p);
n = *p - '0';
while (@@[*(++p)](3) != '\0')
n = n * 8 + (*p) - '0';
printf("%d\n", n);
return 0;
}
```
答案:
第1空:*(++p)