C语言中有哪些字符串处理函数?

如题所述

因为c语言中,数组初始化时,如果给定的初始值个数小于数组长度,那么后面的剩余元素将被自动初始化为0,也就是字符串的结束标志'\0'
strcmp()函数就是用于查找两个以'\0'结束的字符串中的第一个不相同的字符的ascii值之差,如果将数组长度改为5,那么strcmp函数在前5个字符中找不到结束标志,又因为程序不会对边界进行检查,所以会一直找下去,而此时,早已越界,所以会输出不可预见的结果。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2007-02-27
你可以看一下头文件string.h和stdio.h里面的相关函数声明,好多好多。
这里就不一一列出了……比如下面列出的只是其中一部分……
_CRTIMP char * __cdecl strcpy(char *, const char *);
_CRTIMP char * __cdecl strcat(char *, const char *);
_CRTIMP int __cdecl strcmp(const char *, const char *);
_CRTIMP size_t __cdecl strlen(const char *);
_CRTIMP char * __cdecl strchr(const char *, int);
_CRTIMP int __cdecl _strcmpi(const char *, const char *);
_CRTIMP int __cdecl _stricmp(const char *, const char *);
_CRTIMP int __cdecl strcoll(const char *, const char *);
_CRTIMP int __cdecl _stricoll(const char *, const char *);
_CRTIMP int __cdecl _strncoll(const char *, const char *, size_t);
_CRTIMP int __cdecl _strnicoll(const char *, const char *, size_t);
_CRTIMP size_t __cdecl strcspn(const char *, const char *);
_CRTIMP char * __cdecl _strdup(const char *);
_CRTIMP char * __cdecl _strerror(const char *);
_CRTIMP char * __cdecl strerror(int);
_CRTIMP char * __cdecl _strlwr(char *);
_CRTIMP char * __cdecl strncat(char *, const char *, size_t);
_CRTIMP int __cdecl strncmp(const char *, const char *, size_t);
_CRTIMP int __cdecl _strnicmp(const char *, const char *, size_t);
_CRTIMP char * __cdecl strncpy(char *, const char *, size_t);
_CRTIMP char * __cdecl _strnset(char *, int, size_t);
_CRTIMP char * __cdecl strpbrk(const char *, const char *);
_CRTIMP char * __cdecl strrchr(const char *, int);
_CRTIMP char * __cdecl _strrev(char *);
_CRTIMP size_t __cdecl strspn(const char *, const char *);
_CRTIMP char * __cdecl strstr(const char *, const char *);
_CRTIMP char * __cdecl strtok(char *, const char *);
_CRTIMP char * __cdecl _strupr(char *);
_CRTIMP size_t __cdecl strxfrm (char *, const char *, size_t);本回答被网友采纳
第2个回答  2007-02-27
字符串地出入与输出:gets(),puts()
复制字符串函数:strcpy()
连接字符串函数:strcat()
还有一些求长度的,大小写转换的,比较的,那些都不常用。
第3个回答  2007-02-27
这个有很多啦..
你去查书后面的付表就知道了.
比如
getchar()
putchar()
还有比较字符串的,提取字符串字长==的
相似回答