C 标准库函数 第6页

C 库函数 – malloc()

阅读(210)

描述 C 库函数 void *malloc(size_t size) 分配所需的内存空间,并返回一个指向它的指针。 声明 下面是 malloc() 函数的声明。 void *malloc(size_t size) 参数 size -- 内存...

C 库函数 – free()

阅读(193)

描述 C 库函数 void free(void *ptr) 释放之前调用 calloc、malloc 或 realloc 所分配的内存空间。 声明 下面是 free() 函数的声明。 void free(void *ptr) 参数 ptr ...

C 库函数 – calloc()

阅读(226)

描述 C 库函数 void *calloc(size_t nitems, size_t size) 分配所需的内存空间,并返回一个指向它的指针。malloc 和 calloc 之间的不同点是,malloc 不会设置内存为零,而 calloc...

C 库函数 – strtoul()

阅读(185)

描述 C 库函数 unsigned long int strtoul(const char *str, char **endptr, int base) 把参数 str 所指向的字符串根据给定的 base 转换为一个无符号长整数(类型为 u...

C 库函数 – strtol()

阅读(219)

描述 C 库函数 long int strtol(const char *str, char **endptr, int base) 把参数 str 所指向的字符串根据给定的 base 转换为一个长整数(类型为 long int 型),ba...

C 库函数 – strtod()

阅读(299)

描述 C 库函数 double strtod(const char *str, char **endptr) 把参数 str 所指向的字符串转换为一个浮点数(类型为 double 型)。如果 endptr 不为空,则指向转换中最后一个字符后...

C 库函数 – atol()

阅读(246)

描述 C 库函数 long int atol(const char *str) 把参数 str 所指向的字符串转换为一个长整数(类型为 long int 型)。 声明 下面是 atol() 函数的声明。 long int atol(cons...

C 库函数 – atoi()

阅读(222)

描述 C 库函数 int atoi(const char *str) 把参数 str 所指向的字符串转换为一个整数(类型为 int 型)。 声明 下面是 atoi() 函数的声明。 int atoi(const char *str) 参数 ...

C 库函数 – atof()

阅读(214)

描述 C 库函数 double atof(const char *str) 把参数 str 所指向的字符串转换为一个浮点数(类型为 double 型)。 声明 下面是 atof() 函数的声明。 double atof(const char...

C 库函数 – snprintf()

阅读(364)

描述 C 库函数 int snprintf(char *str, size_t size, const char *format, ...) 设将可变参数(...)按照 format 格式化成字符串,并将字符串复制到 str 中,size ...