zoukankan      html  css  js  c++  java
  • C语言细节——库函数

    1、把数字转为字符串,使用sprintf。

         对整型使用%d,长整形为%ld,浮点型为%f。

    2、strncpy()当目标串长度过小时,不能自动在尾部加上’\0’。

        但是当目标串长度过大时,会用多个’\0’填充。

        strcat就可以自动加’\0’

    3、将字符转为大小写,有toupper()和tolower()

    4、把字符串分隔成用空白作间隔符的段,可以使用strtok()

    5、要使用处理正则表达式或通配符匹配的API,可以下载regexp库

    6、库函数中有qsort(void *base, int nelem, int width, int (*fcmp)()),可以对数组进行快速排序

    7、可以使用time(),ctime(),localtime()和strftime()就可以取得当前日期或时间。

  • 相关阅读:
    20140710 sequence 前缀和
    20140709 testC 数学题
    20140708 testA 组合数学
    20140708 testB DP 组合数学
    Sad :(
    已经是一个废人了……
    Game Theory
    HDU Math Problems
    2-sat问题
    并查集
  • 原文地址:https://www.cnblogs.com/steven_oyj/p/1747691.html
Copyright © 2011-2022 走看看