C Standard Library:5 Utility Functions: <stdlib.h>

5 Utility Functions: <stdlib.h>

The header <stdlib.h> declares functions for number conversion, storage allocation, and
similar tasks.

double atof(const char *s)
atof converts s to double; it is equivalent to strtod(s, (char**)NULL).


int atoi(const char *s)
converts s to int; it is equivalent to (int)strtol(s, (char**)NULL, 10).


long atol(const char *s)
converts s to long; it is equivalent to strtol(s, (char**)NULL, 10).


double strtod(const char *s, char **endp)
strtod converts the prefix of s to double, ignoring leading white space; it stores a
pointer to any unconverted suffix in *endp unless endp is NULL. If the answer would
overflow, HUGE_VAL is returned with the proper sign; if the answer would underflow,
zero is returned. In either case errno is set to ERANGE.


long strtol(const char *s, char **endp, int base)
strtol converts the prefix of s to long, ignoring leading white space; it stores a
pointer to any unconverted suffix in *endp unless endp is NULL. If base is between 2
and 36, conversion is done assuming that the input is written in that base. If base is
zero, the base is 8, 10, or 16; leading 0 implies octal and leading 0x or 0X hexadecimal.

Letters in either case represent digits from 10 to base-1; a leading 0x or 0X is
permitted in base 16. If the answer would overflow, LONG_MAX or LONG_MIN is
returned, depending on the sign of the result, and errno is set to ERANGE.


unsigned long strtoul(const char *s, char **endp, int base)
strtoul is the same as strtol except that the result is unsigned long and the error value is ULONG_MAX.


int rand(void)
rand returns a pseudo-random integer in the range 0 to RAND_MAX, which is at least 32767.


void srand(unsigned int seed)
srand uses seed as the seed for a new sequence of pseudo-random numbers. The
initial seed is 1.


void *calloc(size_t nobj, size_t size)
calloc returns a pointer to space for an array of nobj objects, each of size size, or
NULL if the request cannot be satisfied. The space is initialized to zero bytes.


void *malloc(size_t size)
malloc returns a pointer to space for an object of size size, or NULL if the request
cannot be satisfied. The space is uninitialized.


void *realloc(void *p, size_t size)
realloc changes the size of the object pointed to by p to size. The contents will be
unchanged up to the minimum of the old and new sizes. If the new size is larger, the
new space is uninitialized. realloc returns a pointer to the new space, or NULL if the
request cannot be satisfied, in which case *p is unchanged.


void free(void *p)
free deallocates the space pointed to by p; it does nothing if p is NULL. p must be a
pointer to space previously allocated by calloc, malloc, or realloc.


void abort(void)
abort causes the program to terminate abnormally, as if by raise(SIGABRT).


void exit(int status)
exit causes normal program termination. atexit functions are called in reverse order
of registration, open files are flushed, open streams are closed, and control is returned
to the environment. How status is returned to the environment is implementationdependent,
but zero is taken as successful termination. The values EXIT_SUCCESS and
EXIT_FAILURE may also be used.


int atexit(void (*fcn)(void))
atexit registers the function fcn to be called when the program terminates normally;
it returns non-zero if the registration cannot be made.


int system(const char *s)
system passes the string s to the environment for execution. If s is NULL, system
returns non-zero if there is a command processor. If s is not NULL, the return value is
implementation-dependent.


char *getenv(const char *name)
getenv returns the environment string associated with name, or NULL if no string exists.
Details are implementation-dependent.


void *bsearch(const void *key, const void *base,size_t n, size_t size,int (*cmp)(const void *keyval, const void *datum))
bsearch searches base[0]...base[n-1] for an item that matches *key. The function
cmp must return negative if its first argument (the search key) is less than its second (a
table entry), zero if equal, and positive if greater. Items in the array base must be in
ascending order. bsearch returns a pointer to a matching item, or NULL if none exists.


void qsort(void *base, size_t n, size_t size,int (*cmp)(const void *, const void *))
qsort sorts into ascending order an array base[0]...base[n-1] of objects of size
size. The comparison function cmp is as in bsearch.


int abs(int n)
abs returns the absolute value of its int argument.


long labs(long n)
labs returns the absolute value of its long argument.


div_t div(int num, int denom)
div computes the quotient and remainder of num/denom. The results are stored in the
int members quot and rem of a structure of type div_t.


ldiv_t ldiv(long num, long denom)
ldiv computes the quotient and remainder of num/denom. The results are stored in the
long members quot and rem of a structure of type ldiv_t.

转载于:https://www.cnblogs.com/freewater/archive/2013/03/21/2972991.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
牙科就诊管理系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了用户在线查看数据。管理员管理病例管理、字典管理、公告管理、药单管理、药品管理、药品收藏管理、药品评价管理、药品订单管理、牙医管理、牙医收藏管理、牙医评价管理、牙医挂号管理、用户管理、管理员管理等功能。牙科就诊管理系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。 管理员在后台主要管理病例管理、字典管理、公告管理、药单管理、药品管理、药品收藏管理、药品评价管理、药品订单管理、牙医管理、牙医收藏管理、牙医评价管理、牙医挂号管理、用户管理、管理员管理等。 牙医列表页面,此页面提供给管理员的功能有:查看牙医、新增牙医、修改牙医、删除牙医等。公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。药品管理页面,此页面提供给管理员的功能有:新增药品,修改药品,删除药品。药品类型管理页面,此页面提供给管理员的功能有:新增药品类型,修改药品类型,删除药品类型。
这些头文件包含了C/C++编程中常用的一些库和函数的声明,用于支持特定的功能和平台。让我们逐个解释: 1. `<stdio.h>`: 标准输入输出库,提供了基本的文件操作、输入/输出流(stdin, stdout, stderr)以及控制台输入输出函数,如printf()和scanf()。 2. `<easyx.h>`: 这可能是某个特定图形库或游戏开发框架的头文件,如EasyX,它用于创建2D图形程序,处理窗口和图形渲染。 3. `<graphics.h>`: 另一个图形库的头文件,也常用于控制台或早期图形应用,包含了一些基本的图形绘制函数,如CreateWindow(), FillRect()等。 4. `<Windows.h>`: Windows API的头文件,为Windows操作系统下的应用程序提供了一系列系统调用接口,如窗口管理、进程管理、文件操作等。 5. `<stdlib.h>`: 标准库头文件,包含了内存分配、错误处理、数学函数等常用的工具函数。 6. `<time.h>`: 时间处理库,提供了日期和时间相关的函数,如获取当前时间、睡眠等。 7. `<conio.h>`: 控制台输入输出库,在Windows中主要用于处理键盘事件,如getch()函数用于从键盘读取字符。 当你在C/C++代码中包含这些头文件时,它们为你的程序引入了必要的功能,使得能够进行输入输出、图形操作、系统交互等任务。不过,`<easyx.h>`和`<graphics.h>`的具体用法取决于你使用的具体框架或库,如果它们是自定义的或不存在,可能需要额外的文档说明。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值