C语言函数库

从今天开始,慢慢的写全c语言函数库的函数使用代码

1.函数名: atoi

功  能: 把字符串转换成长整型数
用  法: int atoi(const char *nptr);需要传进一个char类型的指针
程序例:

#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   int n;
   char *str = "12345.67";
   n = atoi(str);
   printf("string = %s integer = %d\n", str, n);//string = 12345.67 integer = 12345
   return 0;
}

2.abort

功  能: 异常终止一个进程
用  法: void abort(void)
程序例:

#include <stdio.h>

int main(void){
    printf("call abort()\n");//会被执行
    abort();
    printf("call abort()\n");//由于程序的进程被终止了,abort之后的代码都不会被执行。
    return 0;
}

3.函数名: abs

功 能: 求整数的绝对值用 法: int abs(int i);

程序例:

#include <stdio.h>

int main(void){
    int a = -1100;
    printf("利用abs()函数,要显示正整数a = %d\n" , abs(a));//很显然,结果为1100
    return 0;
}

4.函数名:absread , abswrite

功能:绝对磁盘的读和写

用法:int absread(int drive , int nsects , int sectno , void *buffer);

int abswrite(int drive , int nsects , int tsectno , void *buffer);

程序例

 

转载于:https://www.cnblogs.com/ComputerG/archive/2010/04/11/1709794.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值