#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int fun( char *t )
{ int n,j,k,i=0;
char *p=t;
n=strlen(p);
for(j=0;j<n;j++)
{
if((*p+j)==*(p+j))
k=1;
else
k=0;
}
return k;
}
int main()
{ int n;
char s[30];
gets(s);
n=fun(s);
switch (n)
{
case 0:
printf("字符串不是连续的\n");break;
case 1:
printf("字符串是连续的\n");break;
}
system("pause");
return 0;
}
注意:这里重点是比较 *(p+j)与*p+j的值,例如输入的是字符串ABC,当j=2时 *(p+j)=*p+j;但是当j=3时,*(p+j)=0,而*p+j=D(数值)