*白朔的博客#include <stdio.h> int main() { char a[20]; char *p; gets(a); p = a; while(*p!='\0') p++; printf("Length of the string is %d\n",p-a); return 0; }
山野雾灯ccc的博客#include<stdio.h> int my_strlen1(const char *str)//指针相减方法 { const char *p=str; while (*str) { ...//指针-指针是元素个数 ...//通过定义变量计数 while (str[i]) { i++; } return i; } int m.