C 标准函数库

 1、数学函数
 #include<math.h>
 函数名        函数原型          功     能      返回值                说明
 abs     int abs(int x)          x的绝对值       结果 
 fabs    double fabs(double x)   x的绝对值       结果
 acos    double acos(double x)   反三角函数      结果               x 在[-1,1]
 asin    double asin(double x)   反三角函数      结果               x 在[-1,1]
 atan    double atan(double x)   反三角函数      结果               x 在[-1,1]
 atan2   double atan2(double x,  x/y 的反三
                double y);           角函数      结果
 cos     double cos(double x)    三角函数        结果   
 cosh    double cosh(double x)   x 的双曲余弦    结果
 sin     double sin(double x)    三角函数        结果
 sinh    double sinh(double x)   x 的双曲正弦    结果
 tan     double tan(double x)    三角函数        结果
 tanh    double tanh(double x)   x 的双曲正切    结果
 exp     double exp(double x)      e^x           结果
 floor   double floor(double x)  <=x 最大整数    整数的双精度实数
 ceil    double ceil(double x)   >=x 最小整数    整数的双精度实数
 fmod    double fmod(double x,   x/y 余数        余数的双精度实数
                double y);
 frexp   double frexp(double val, val=x* 2^n     返回数字部分
             int *eptr);       n 存在eptr中   x 在[0.5,1]
 log     double log(double x)     即 ln x        结果
 log10   double log10(double x)   以10为底       结果
 modf    double modf(double val,  val= 整数部分  返回小数部分 x
                double *iptr);       + 小数部分  整数存在 iptr 中
 pow     double pow(double x,     x^y            结果
             double y);      
 rand    int rand(void);          随机数 [-90,32767]   随机整数
 sqrt    double sqrt(double x)    x 的平方根     结果
 2、字符函数和字符串函数
 #include<string.h>
 函数名       函数原型             功     能              返回值
 isalnum int isalnum(int ch)     检查ch是否字母(alpha)   字母,返回1,
                                 或数字(numeric)。       否则,返回0。
 isalpha int isalpha(int ch)     检查ch是否字母。        是,返回1,
                                                         否则,返回0。
 iscntrl int iscntrl(int ch)     检查ch是否控制字符(其   是,返回1,
                                 ASC2码在0和0xlf之间)。  否则,返回0。                               
 isdigit int isdigit(int ch)     检查ch是否数字(0 ~ 9)。 是,返回1,
                                                         否则,返回0。
 isgraph int isgraph(int ch)     检查ch是否可打印字符    是,返回1,
                                 (其ASC2码在0x21和0x7E   否则,返回0。
         之间)不包括空格。
 islower int islower(int ch)     检查ch是否小写字母。    是,返回1,
                                  (a ~ Z)                否则,返回0。
 isprint int isprint(int ch)     检查ch是否可打印字符    是,返回1,
                                 (其ASC2码在0x20和0x7E   否则,返回0。
         之间)包括空格。
 ispunct int ispunct(int ch)     检查ch是否标点字符(不   是,返回1,
                                 包括空格),即除字母、   否则,返回0。
         数字和空格以外的所有
         可打印字符。
 isspace int isspace(int ch)     检查ch是否空格、跳格符     是,返回1,
                                 (制表符)或换行符。         否则,返回0.
 isupper int isupper(int ch)     检查ch是否大写字母(A ~ Z)   是,返回1,
                                                           否则,返回0.
 isxdigit int isxdigit(int ch)   检查ch是否十六进制数字     是,返回1,
                                 字符 (即0~9, A~F 或 a~f)   否则,返回0.
 strcat  char *strcat(char       把字符串str1接到str2后面,   str1
          * str1, char * str2)   最后面的'/0'被取消.
 strchr  char *strchr(char       找出指向str的字符串中第  返回该位置指针,若找
          * str,  int ch);       一次出现字符ch的位置 .   不到,返回空指针.
 strcmp  int strcmp(char *       比较两个字符串str1, str2.  str1<str2, 负
       str1,   char * str2)                              str1=str2, 0
                                                            str1>str2, 正
 strcpy  char *strcpy(char       把str2指向的字符串拷贝     str1
          * str1, char * str2)   到str1中去.
 strlen  unsigned int strlen     统计字符串str中字符的      返回字符个数
               (char *str);      个数(不包括'/0')
 strstr  char *strstr(char       找出str2在str1第一次出现   返回位置指针, 若找
       * str1, char * str2)   的位置(不包括str2串结束符) 不到,返回空指针.
 tolower int tolower(int ch)     将字符ch转换为小写字母.    返回大写字母.
 toupper int toupper(int ch)     将字符ch转换为大写字母.    返回小写字母.
 3、动态存储分配函数
 #include<stdlib.h>
 void *calloc(unsigned n,unsigned size);  //返回分配内存单元的起始地址, 如不成功,返回0.
          //分配n个数据项的内存连续空间,每个数据项的大小为size.
 void free(void *p);  //释放 p 所指的内存区.
 void *malloc(unsigned size)  //分配 size字节的存储区.
 void *realloc(void *p, unsigned size);    //返回指向该内存区的指针
         //将 p所指出的已分配内存区的大小改为 size, size 可比原来分配的空间大或小
        
 注: void 指针类型, 在赋值给另一个指针变量之前, 要进行强制转换.
     void *fun(char ch1, char ch2);
     p1=(char *)fun(ch1, ch2);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值