chenningpo的个人空间 https://www.eechina.com/space-uid-73326.html [收藏] [复制] [RSS]

博客

c语言常用头文件包含的库函数

已有 740 次阅读2013-3-19 17:14

c语言常用头文件包含的库函数

math.h常用函数

int abs   (int x);
double acos (double x);
double asin (double x);
double atan (double x);
double atan2 (double y, double x);
double atof (const char *s);
double ceil (double x);
double cos   (double x);
double cosh (double x);
double exp   (double x);
double fabs (double x);
double floor (double x);
double fmod (double x, double y);
double frexp (double x, int *exponent);
long labs (long x);
double ldexp (double x, int exponent);
double log   (double x);
double log10 (double x);
double modf (double x, double *ipart);
double pow   (double x, double y);
double sin   (double x);
double sinh (double x);
double sqrt (double x);
double tan   (double x);
double tanh (double x);


stdio.h常用函数包括
int       fclose   (FILE *stream);
int       fflush   (FILE *stream);
int       fgetc    (FILE *stream);
int       fgetpos (FILE *stream, fpos_t *pos);
char    * fgets    (char *s, int n, FILE *stream);
FILE    * fopen    (const char *path, const char *mode);
int       fprintf (FILE *stream, const char *format, ...);
int       fputc    (int c, FILE *stream);
int       fputs    (const char *s, FILE *stream);
size_t    fread    (void *ptr, size_t size, size_t n, FILE *stream);
FILE    * freopen (const char *path, const char *mode, 
                          FILE *stream);
int       fscanf   (FILE *stream, const char *format, ...);
int       fseek    (FILE *stream, long offset, int whence);
int       fsetpos (FILE *stream, const fpos_t *pos);
long      ftell    (FILE *stream);
size_t    fwrite   (const void *ptr, size_t size, size_t n,
                          FILE *stream);
int       printf   (const char *format, ...);
int       puts     (const char *s);
int       rename   (const char *oldname, const char *newname);
void      rewind   (FILE *stream);
int       scanf    (const char *format, ...);


stdlib.h常用函数包括
int      abs    (int x);
int      atexit (atexit_t func);
double   atof   (const char *s);
int      atoi   (const char *s);
long     atol   (const char *s);
void   * bsearch(const void *key, const void *base, 
                       size_t nelem, size_t width,
                       int (*fcmp)(/* const void *, const void * */));
void   * calloc (size_t nitems, size_t size);
div_t    div    (int numer, int denom);
void     exit   (int status);
void     free   (void *block);
char   * getenv (const char *name);
long     labs   (long x);
ldiv_t   ldiv   (long numer, long denom);
void   * malloc (size_t size);
void     qsort (void *base, size_t nelem, size_t width,
                       int (*fcmp)(/* const void *, const void * */));
int      rand   (void);
void   * realloc(void *block, size_t size);
void     srand (unsigned seed);
double   strtod (const char *s, char **endptr);
long     strtol (const char *s, char **endptr, int radix);
unsigned long strtoul (const char *s, char **endptr, int radix);
int      system (const char *command);
max(a,b)        (((a) > (b)) ? (a) : (b))
min(a,b)        (((a) < (b)) ? (a) : (b))

random(num)     (rand() % (num))
randomize()     srand((unsigned)time(NULL))


string.h常用函数包括:
char * stpcpy (char *dest, const char *src);
char * strcat (char *dest, const char *src);
char * strchr (const char *s, int c);
int   strcmp (const char *s1, const char *s2);
char * strcpy (char *dest, const char *src);
size_t   strcspn (const char *s1, const char *s2);
char * strdup (const char *s);
char * strerror(int errnum);


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

关于我们  -  服务条款  -  使用指南  -  站点地图  -  友情链接  -  联系我们
电子工程网 © 版权所有   京ICP备16069177号 | 京公网安备11010502021702
返回顶部