在学C,comparison between pointer and integer求解答#includevoid main(){\x05char a[30];\x05char *p;\x05int i;\x05printf("please input a string:\n");\x05scanf("%s",a);\x05printf("result:\n");\x05printf("%s\n",a);\x05i=0;\x05while(a[i]!=NULL){\x05\x
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 08:58:58
在学C,comparison between pointer and integer求解答#includevoid main(){\x05char a[30];\x05char *p;\x05int i;\x05printf("please input a string:\n");\x05scanf("%s",a);\x05printf("result:\n");\x05printf("%s\n",a);\x05i=0;\x05while(a[i]!=NULL){\x05\x
在学C,comparison between pointer and integer求解答
#include
void main(){
\x05char a[30];
\x05char *p;
\x05int i;
\x05printf("please input a string:\n");
\x05scanf("%s",a);
\x05printf("result:\n");
\x05printf("%s\n",a);
\x05i=0;
\x05while(a[i]!=NULL){
\x05\x05printf("%c",a[i]);
\x05\x05i++;
\x05}
\x05printf("\n");
\x05p=a;
\x05printf("%s\n",p);
\x05while(*p!=NULL){
\x05\x05printf("%c",*p);
\x05\x05p++;
\x05}
在学C,comparison between pointer and integer求解答#includevoid main(){\x05char a[30];\x05char *p;\x05int i;\x05printf("please input a string:\n");\x05scanf("%s",a);\x05printf("result:\n");\x05printf("%s\n",a);\x05i=0;\x05while(a[i]!=NULL){\x05\x
因为不是比较指针, 所以这里不要用NULL
用0或者'\0'都好