• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C语言函数库

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

从今天开始,慢慢的写全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);

程序例

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C#-MVC开发微信应用(7)--在管理系统中同步微信用户分组信息发布时间:2022-07-13
下一篇:
C# Bitmap生成base64码发布时间:2022-07-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap