#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char a[]="hello word" ;
char c[]="h";
char *b;
int main()
{
b=a; //指针指向a数组
int len=strlen(b);
// int len1=sizeof(a); //sizeof函数判断时,算\n,共11个字符,sizeof b 判断的是指针长度
printf("The new string is:");
printf("%s\n",b);
printf("%d\n",len);
// printf("%d\n",len1);
while(*b)
{
printf("_%c \n",*b);//break;
b++;
int x =strcmp(b,c);
if(x!=0) printf("no \n");
else
{
printf("yes ! is here!!\n");
*b=*b++;
}
//printf("%d \n",x);
}
return 0;
}
c指针数组比对程序
最新推荐文章于 2020-04-09 14:56:08 发布