洪恩在线讲了这方面的知识。
int mystrlen(char *str) { int n = 0; while (*str) { n++; str++;} return n; } void main() { char str[51]; printf("please enter the string (less than 50 characters): "); scanf("%s", str); printf("\nthe length of the string is %d.\n", mystrlen(str)); }
入门:清华大学出版社,谭浩强的c语言程序设计 可以用turbo c,环境比较单纯,针对这个环境的书也比较多。 vc++也是可以的,虽然稍微有些复杂,但以后如果一直学c/c++多半是要过渡到这个环境的。