一道C语言指针类问题(有答案,解释一下过程)
main(){char*p[]={"3697","2584"};inti,j;longnum=0;for(i=0;i<2;i++){j=0;while(p[i][j]!=...
main()
{char *p[]={ " 3697 "," 2584 "};
int i,j; long num=0;
for(i=0;i<2;i++)
{j=0;
while(p[i][j]!='\0')
{if((p[i][j]-'0')%2) num=10*num+p[i][j]-'0';
j+=2;}
}
printf("%d\n",num);
}
答案:39.
。 展开
{char *p[]={ " 3697 "," 2584 "};
int i,j; long num=0;
for(i=0;i<2;i++)
{j=0;
while(p[i][j]!='\0')
{if((p[i][j]-'0')%2) num=10*num+p[i][j]-'0';
j+=2;}
}
printf("%d\n",num);
}
答案:39.
。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询