标签:string pre strlen int ring ase puts print ons
#include <stdio.h> int mystrlen(const char *str) { int n=0; const char *p = str; while(*p++ != ‘\0‘) { n++; } return n; } int main() { char str1[100] = {‘\0‘}; int ret = 0; puts("please intput string ,the string length max = 99"); puts("eg: abcdef"); scanf("%s",str1); ret = mystrlen(str1); printf("\n"); printf("result: %s length: %d\n",str1,ret); }
标签:string pre strlen int ring ase puts print ons
原文地址:https://www.cnblogs.com/liushuhe1990/p/9609106.html