使用函数库
1.人们把大量的基础性操作编写成一个个独立的函数,这些函数具有低耦合、高内聚的特点,这些函数集合成一个已经编译好的不完整的二进制代码文件,就是函数库
2.根据数据库中函数逻辑加载的时间不同,可分为静态库、载入连接库、动态连接库。
(1)静态库是在连接的时候被加入到应用程序的可执行文件中的
(2)载入连接库在编译是并不将库的内容添加到应用程序的可执行文件中
(3)动态连接库是在程序运行过程根据需要动态加载到程序中的
字符操作
测试参数所对应的字符是否为拉丁字母
#include < ctype.h>
#int isalpha(int c);
测试参数所对应的字符是否为大写字母(isupper)或小写字母(islower)
#include < ctype.h>
#int isupper(int c);
#int islower(int c);
测试参数所对应的字符是否为阿拉伯数字(isdigit)或十六进制数字(isxdigit)
#include <ctype.h>
#int isdigit(int c);
#int isxdigit(int c);
测试参数所对应的字符是否为拉丁字母或阿拉伯数字
#include <ctype.h>
#int isalnum(int c);
测试参数所对应的字符是否为空白字符
#include <ctype.h>
#int isspace(int c);
测试参数所对应的字符是否为标点符号或特殊符号
#include <ctype.h>
#int ispunct(int c);
测试参数所对应的字符是否为可打印字符
#include <ctype.h>
#int isgraph(int c);
#int isprint(int c);
字符串操作
字符串是编程中一种重要的数据类型,因为用户通过键盘的输入都是采用字符串的形式的
数据类型转换
将字符串转化成整型
#include <stdlib.h>
int atoi(const char * nptr);
将字符串转化成长整型
#include <stdlib.h>
long atoi(const char * nptr);
见字符串转化成双精度浮点型
#include <stdlib.h>
double atof(const char * nptr);
将所提供的数字转化成字符串
#include <stdlib.h>
char * gcvt ( double number , size_tndigits , char * buf );
将字符串转化成成长整型
#include <stdlib.h>
long strtol (const char * nptr , char * * endptr , int base);
字符串数据处理
找到字符串第一次出现某一字符(或字符代码)的位置
#include <string.h>
char * index(const char * s, int c);
char* strchr(const char * s, int c);
找到字符串最后一次出现某一字符(或字符代码)的位置
#include <string.h>
char * rindex(const char * s, int c);
char * strrchr(const char * s, int c);
计算字符串的长度
#include <string.h>
int strlen(const char * s);
字符串拷贝
#include <string.h>
char * strcpy(char * dest, const char * src);
char * strncpy(char * dest, const char * src, size_ t n);
将两个字符串连接成一个字符串
#include <string.h>
char * strcat(char * dest, const char * src);
char * strncat(char * dest, const char * src, size_t n);