『壹』 求c語言庫函數大全!請大家幫忙!謝了!
int isalpha(int ch) 若ch是字母('A'-'Z','a'-'z')返回非0值,否則返回0
int isalnum(int ch) 若ch是字母('A'-'Z','a'-'z')或數字('0'-'9')
返回非0值,否則返回0
int isascii(int ch) 若ch是字元(ASCII碼中的0-127)返回非0值,否則返回0
int iscntrl(int ch) 若ch是作廢字元(0x7F)或普通控制字元(0x00-0x1F)
返回非0值,否則返回0
int isdigit(int ch) 若ch是數字('0'-'9')返回非0值,否則返回0
int isgraph(int ch) 若ch是可列印字元(不含空格)(0x21-0x7E)返回非0值,否則返回0
int islower(int ch) 若ch是小寫字母('a'-'z')返回非0值,否則返回0
int isprint(int ch) 若ch是可列印字元(含空格)(0x20-0x7E)返回非0值,否則返回0
int ispunct(int ch) 若ch是標點字元(0x00-0x1F)返回非0值,否則返回0
int isspace(int ch) 若ch是空格(' '),水平製表符('\t'),回車符('\r'),
走紙換行('\f'),垂直製表符('\v'),換行符('\n')
返回非0值,否則返回0
int isupper(int ch) 若ch是大寫字母('A'-'Z')返回非0值,否則返回0
int isxdigit(int ch) 若ch是16進制數('0'-'9','A'-'F','a'-'f')返回非0值,
否則返回0
int tolower(int ch) 若ch是大寫字母('A'-'Z')返回相應的小寫字母('a'-'z')
int toupper(int ch) 若ch是小寫字母('a'-'z')返回相應的大寫字母('A'-'Z')
========數學函數(原型聲明所在頭文件為math.h、stdlib.h、string.h、float.h)===========
int abs(int i) 返回整型參數i的絕對值
double cabs(struct complex znum) 返回復數znum的絕對值
double fabs(double x) 返回雙精度參數x的絕對值
long labs(long n) 返回長整型參數n的絕對值
double exp(double x) 返回指數函數ex的值
double frexp(double value,int *eptr) 返回value=x*2n中x的值,n存貯在eptr中
double ldexp(double value,int exp); 返回value*2exp的值
double log(double x) 返回logex的值
double log10(double x) 返回log10x的值
double pow(double x,double y) 返回xy的值
double pow10(int p) 返回10p的值
double sqrt(double x) 返回x的開方
double acos(double x) 返回x的反餘弦cos-1(x)值,x為弧度
double asin(double x) 返回x的反正弦sin-1(x)值,x為弧度
double atan(double x) 返回x的反正切tan-1(x)值,x為弧度
double atan2(double y,double x) 返回y/x的反正切tan-1(x)值,y的x為弧度
double cos(double x) 返回x的餘弦cos(x)值,x為弧度
double sin(double x) 返回x的正弦sin(x)值,x為弧度
double tan(double x) 返回x的正切tan(x)值,x為弧度
double cosh(double x) 返回x的雙曲餘弦cosh(x)值,x為弧度
double sinh(double x) 返回x的雙曲正弦sinh(x)值,x為弧度
double tanh(double x) 返回x的雙曲正切tanh(x)值,x為弧度
double hypot(double x,double y) 返回直角三角形斜邊的長度(z),
x和y為直角邊的長度,z2=x2+y2
double ceil(double x) 返回不小於x的最小整數
double floor(double x) 返回不大於x的最大整數
void srand(unsigned seed) 初始化隨機數發生器
int rand() 產生一個隨機數並返回這個數
double poly(double x,int n,double c[])從參數產生一個多項式
double modf(double value,double *iptr)將雙精度數value分解成尾數和階
double fmod(double x,double y) 返回x/y的余數
double frexp(double value,int *eptr) 將雙精度數value分成尾數和階
double atof(char *nptr) 將字元串nptr轉換成浮點數並返回這個浮點數
double atoi(char *nptr) 將字元串nptr轉換成整數並返回這個整數
double atol(char *nptr) 將字元串nptr轉換成長整數並返回這個整數
char *ecvt(double value,int ndigit,int *decpt,int *sign)
將浮點數value轉換成字元串並返回該字元串
char *fcvt(double value,int ndigit,int *decpt,int *sign)
將浮點數value轉換成字元串並返回該字元串
char *gcvt(double value,int ndigit,char *buf)
將數value轉換成字元串並存於buf中,並返回buf的指針
char *ultoa(unsigned long value,char *string,int radix)
將無符號整型數value轉換成字元串並返回該字元串,radix為轉換時所用基數
char *ltoa(long value,char *string,int radix)
將長整型數value轉換成字元串並返回該字元串,radix為轉換時所用基數
char *itoa(int value,char *string,int radix)
將整數value轉換成字元串存入string,radix為轉換時所用基數
double atof(char *nptr) 將字元串nptr轉換成雙精度數,並返回這個數,錯誤返回0
int atoi(char *nptr) 將字元串nptr轉換成整型數, 並返回這個數,錯誤返回0
long atol(char *nptr) 將字元串nptr轉換成長整型數,並返回這個數,錯誤返回0
double strtod(char *str,char **endptr)將字元串str轉換成雙精度數,並返回這個數,
long strtol(char *str,char **endptr,int base)將字元串str轉換成長整型數,
並返回這個數,
int matherr(struct exception *e)
用戶修改數學錯誤返回信息函數(沒有必要使用)
double _matherr(_mexcep why,char *fun,double *arg1p,
double *arg2p,double retval)
用戶修改數學錯誤返回信息函數(沒有必要使用)
unsigned int _clear87() 清除浮點狀態字並返回原來的浮點狀態
void _fpreset() 重新初使化浮點數學程序包
unsigned int _status87() 返回浮點狀態字
============目錄函數(原型聲明所在頭文件為dir.h、dos.h)================
int chdir(char *path) 使指定的目錄path(如:"C:\\WPS")變成當前的工作目錄,成
功返回0
int findfirst(char *pathname,struct ffblk *ffblk,int attrib)查找指定的文件,成功
返回0
pathname為指定的目錄名和文件名,如"C:\\WPS\\TXT"
ffblk為指定的保存文件信息的一個結構,定義如下:
┏━━━━━━━━━━━━━━━━━━┓
┃struct ffblk ┃
┃{ ┃
┃ char ff_reserved[21]; /*DOS保留字*/┃
┃ char ff_attrib; /*文件屬性*/ ┃
┃ int ff_ftime; /*文件時間*/ ┃
┃ int ff_fdate; /*文件日期*/ ┃
┃ long ff_fsize; /*文件長度*/ ┃
┃ char ff_name[13]; /*文件名*/ ┃
┃} ┃
┗━━━━━━━━━━━━━━━━━━┛
attrib為文件屬性,由以下字元代表
┏━━━━━━━━━┳━━━━━━━━┓
┃FA_RDONLY 只讀文件┃FA_LABEL 卷標號┃
┃FA_HIDDEN 隱藏文件┃FA_DIREC 目錄 ┃
┃FA_SYSTEM 系統文件┃FA_ARCH 檔案 ┃
┗━━━━━━━━━┻━━━━━━━━┛
例:
struct ffblk ff;
findfirst("*.wps",&ff,FA_RDONLY);
int findnext(struct ffblk *ffblk) 取匹配finddirst的文件,成功返回0
void fumerge(char *path,char *drive,char *dir,char *name,char *ext)
此函數通過盤符drive(C:、A:等),路徑dir(\TC、\BC\LIB等),
文件名name(TC、WPS等),擴展名ext(.EXE、.COM等)組成一個文件名
存與path中.
int fnsplit(char *path,char *drive,char *dir,char *name,char *ext)
此函數將文件名path分解成盤符drive(C:、A:等),路徑dir(\TC、\BC\LIB等),
文件名name(TC、WPS等),擴展名ext(.EXE、.COM等),並分別存入相應的變數中.
int getcurdir(int drive,char *direc) 此函數返回指定驅動器的當前工作目錄名稱
drive 指定的驅動器(0=當前,1=A,2=B,3=C等)
direc 保存指定驅動器當前工作路徑的變數 成功返回0
char *getcwd(char *buf,iint n) 此函數取當前工作目錄並存入buf中,直到n個字
節長為為止.錯誤返回NULL
int getdisk() 取當前正在使用的驅動器,返回一個整數(0=A,1=B,2=C等)
int setdisk(int drive) 設置要使用的驅動器drive(0=A,1=B,2=C等),
返回可使用驅動器總數
int mkdir(char *pathname) 建立一個新的目錄pathname,成功返回0
int rmdir(char *pathname) 刪除一個目錄pathname,成功返回0
char *mktemp(char *template) 構造一個當前目錄上沒有的文件名並存於template中
char *searchpath(char *pathname) 利用MSDOS找出文件filename所在路徑,
,此函數使用DOS的PATH變數,未找到文件返回NULL
===========進程函數(原型聲明所在頭文件為stdlib.h、process.h)===========
void abort() 此函數通過調用具有出口代碼3的_exit寫一個終止信息於stderr,
並異常終止程序。無返回值
int exec…裝入和運行其它程序
int execl( char *pathname,char *arg0,char *arg1,…,char *argn,NULL)
int execle( char *pathname,char *arg0,char *arg1,…,
char *argn,NULL,char *envp[])
int execlp( char *pathname,char *arg0,char *arg1,…,NULL)
int execlpe(char *pathname,char *arg0,char *arg1,…,NULL,char *envp[])
int execv( char *pathname,char *argv[])
int execve( char *pathname,char *argv[],char *envp[])
int execvp( char *pathname,char *argv[])
int execvpe(char *pathname,char *argv[],char *envp[])
exec函數族裝入並運行程序pathname,並將參數
arg0(arg1,arg2,argv[],envp[])傳遞給子程序,出錯返回-1
在exec函數族中,後綴l、v、p、e添加到exec後,
所指定的函數將具有某種操作能力
有後綴 p時,函數可以利用DOS的PATH變數查找子程序文件。
l時,函數中被傳遞的參數個數固定。
v時,函數中被傳遞的參數個數不固定。
e時,函數傳遞指定參數envp,允許改變子進程的環境,
無後綴e時,子進程使用當前程序的環境。
void _exit(int status)終止當前程序,但不清理現場
void exit(int status) 終止當前程序,關閉所有文件,寫緩沖區的輸出(等待輸出),
並調用任何寄存器的"出口函數",無返回值
int spawn…運行子程序
int spawnl( int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL)
int spawnle( int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL,char *envp[])
int spawnlp( int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL)
int spawnlpe(int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL,char *envp[])
int spawnv( int mode,char *pathname,char *argv[])
int spawnve( int mode,char *pathname,char *argv[],char *envp[])
int spawnvp( int mode,char *pathname,char *argv[])
int spawnvpe(int mode,char *pathname,char *argv[],char *envp[])
spawn函數族在mode模式下運行子程序pathname,並將參數
arg0(arg1,arg2,argv[],envp[])傳遞給子程序.出錯返回-1
mode為運行模式
mode為 P_WAIT 表示在子程序運行完後返回本程序
P_NOWAIT 表示在子程序運行時同時運行本程序(不可用)
P_OVERLAY表示在本程序退出後運行子程序
在spawn函數族中,後綴l、v、p、e添加到spawn後,
所指定的函數將具有某種操作能力
有後綴 p時, 函數利用DOS的PATH查找子程序文件
l時, 函數傳遞的參數個數固定.
v時, 函數傳遞的參數個數不固定.
e時, 指定參數envp可以傳遞給子程序,允許改變子程序運行環境.
當無後綴e時,子程序使用本程序的環境.
int system(char *command) 將MSDOS命令command傳遞給DOS執行
======轉換子程序(函數原型所在頭文件為math.h、stdlib.h、ctype.h、float.h)========
char *ecvt(double value,int ndigit,int *decpt,int *sign)
將浮點數value轉換成字元串並返回該字元串
char *fcvt(double value,int ndigit,int *decpt,int *sign)
將浮點數value轉換成字元串並返回該字元串
char *gcvt(double value,int ndigit,char *buf)
將數value轉換成字元串並存於buf中,並返回buf的指針
char *ultoa(unsigned long value,char *string,int radix)
將無符號整型數value轉換成字元串並返回該字元串,radix為轉換時所用基數
char *ltoa(long value,char *string,int radix)
將長整型數value轉換成字元串並返回該字元串,radix為轉換時所用基數
char *itoa(int value,char *string,int radix)
將整數value轉換成字元串存入string,radix為轉換時所用基數
double atof(char *nptr) 將字元串nptr轉換成雙精度數,並返回這個數,錯誤返回0
int atoi(char *nptr) 將字元串nptr轉換成整型數, 並返回這個數,錯誤返回0
long atol(char *nptr) 將字元串nptr轉換成長整型數,並返回這個數,錯誤返回0
double strtod(char *str,char **endptr)將字元串str轉換成雙精度數,並返回這個數,
long strtol(char *str,char **endptr,int base)將字元串str轉換成長整型數,
並返回這個數,
int toascii(int c) 返回c相應的ASCII
int tolower(int ch) 若ch是大寫字母('A'-'Z')返回相應的小寫字母('a'-'z')
int _tolower(int ch) 返回ch相應的小寫字母('a'-'z')
int toupper(int ch) 若ch是小寫字母('a'-'z')返回相應的大寫字母('A'-'Z')
int _toupper(int ch) 返回ch相應的大寫字母('A'-'Z')
『貳』 c語言數學函數庫怎麼用
摘要 調用數學函數時,要求在源文件中包下以下命令行:#include
『叄』 c語言標准函數庫的介紹
在C語言程序設計里,C 標准函數(C Standard library)是所有目前符合標準的頭文件(head file)的集合,以及常用的函數庫實現程序,例如 I/O輸入輸出和字串符控制。不像 COBOL、Forrian和 PL/I等編程語言,在 C 語言的工作任務里不會包含嵌入的關鍵字,所以幾乎所有的 C 語言程序都是由標准函數庫的函數來創建的。
『肆』 c語言他對應的函數庫是什麼
int isalpha(int ch) 若ch是字母('A'-'Z','a'-'z')返回非0值,否則返回0
int isalnum(int ch) 若ch是字母('A'-'Z','a'-'z')或數字('0'-'9')
返回非0值,否則返回0
int isascii(int ch) 若ch是字元(ASCII碼中的0-127)返回非0值,否則返回0
int iscntrl(int ch) 若ch是作廢字元(0x7F)或普通控制字元(0x00-0x1F)
返回非0值,否則返回0
int isdigit(int ch) 若ch是數字('0'-'9')返回非0值,否則返回0
int isgraph(int ch) 若ch是可列印字元(不含空格)(0x21-0x7E)返回非0值,否則返回0
int islower(int ch) 若ch是小寫字母('a'-'z')返回非0值,否則返回0
int isprint(int ch) 若ch是可列印字元(含空格)(0x20-0x7E)返回非0值,否則返回0
int ispunct(int ch) 若ch是標點字元(0x00-0x1F)返回非0值,否則返回0
int isspace(int ch) 若ch是空格(' '),水平製表符('\t'),回車符('\r'),
走紙換行('\f'),垂直製表符('\v'),換行符('\n')
返回非0值,否則返回0
int isupper(int ch) 若ch是大寫字母('A'-'Z')返回非0值,否則返回0
int isxdigit(int ch) 若ch是16進制數('0'-'9','A'-'F','a'-'f')返回非0值,
否則返回0
int tolower(int ch) 若ch是大寫字母('A'-'Z')返回相應的小寫字母('a'-'z')
int toupper(int ch) 若ch是小寫字母('a'-'z')返回相應的大寫字母('A'-'Z')
========數學函數(原型聲明所在頭文件為math.h、stdlib.h、string.h、float.h)===========
int abs(int i) 返回整型參數i的絕對值
double cabs(struct complex znum) 返回復數znum的絕對值
double fabs(double x) 返回雙精度參數x的絕對值
long labs(long n) 返回長整型參數n的絕對值
double exp(double x) 返回指數函數ex的值
double frexp(double value,int *eptr) 返回value=x*2n中x的值,n存貯在eptr中
double ldexp(double value,int exp); 返回value*2exp的值
double log(double x) 返回logex的值
double log10(double x) 返回log10x的值
double pow(double x,double y) 返回xy的值
double pow10(int p) 返回10p的值
double sqrt(double x) 返回x的開方
double acos(double x) 返回x的反餘弦cos-1(x)值,x為弧度
double asin(double x) 返回x的反正弦sin-1(x)值,x為弧度
double atan(double x) 返回x的反正切tan-1(x)值,x為弧度
double atan2(double y,double x) 返回y/x的反正切tan-1(x)值,y的x為弧度
double cos(double x) 返回x的餘弦cos(x)值,x為弧度
double sin(double x) 返回x的正弦sin(x)值,x為弧度
double tan(double x) 返回x的正切tan(x)值,x為弧度
double cosh(double x) 返回x的雙曲餘弦cosh(x)值,x為弧度
double sinh(double x) 返回x的雙曲正弦sinh(x)值,x為弧度
double tanh(double x) 返回x的雙曲正切tanh(x)值,x為弧度
double hypot(double x,double y) 返回直角三角形斜邊的長度(z),
x和y為直角邊的長度,z2=x2+y2
double ceil(double x) 返回不小於x的最小整數
double floor(double x) 返回不大於x的最大整數
void srand(unsigned seed) 初始化隨機數發生器
int rand() 產生一個隨機數並返回這個數
double poly(double x,int n,double c[])從參數產生一個多項式
double modf(double value,double *iptr)將雙精度數value分解成尾數和階
double fmod(double x,double y) 返回x/y的余數
double frexp(double value,int *eptr) 將雙精度數value分成尾數和階
double atof(char *nptr) 將字元串nptr轉換成浮點數並返回這個浮點數
double atoi(char *nptr) 將字元串nptr轉換成整數並返回這個整數
double atol(char *nptr) 將字元串nptr轉換成長整數並返回這個整數
char *ecvt(double value,int ndigit,int *decpt,int *sign)
將浮點數value轉換成字元串並返回該字元串
char *fcvt(double value,int ndigit,int *decpt,int *sign)
將浮點數value轉換成字元串並返回該字元串
char *gcvt(double value,int ndigit,char *buf)
將數value轉換成字元串並存於buf中,並返回buf的指針
char *ultoa(unsigned long value,char *string,int radix)
將無符號整型數value轉換成字元串並返回該字元串,radix為轉換時所用基數
char *ltoa(long value,char *string,int radix)
將長整型數value轉換成字元串並返回該字元串,radix為轉換時所用基數
char *itoa(int value,char *string,int radix)
將整數value轉換成字元串存入string,radix為轉換時所用基數
double atof(char *nptr) 將字元串nptr轉換成雙精度數,並返回這個數,錯誤返回0
int atoi(char *nptr) 將字元串nptr轉換成整型數, 並返回這個數,錯誤返回0
long atol(char *nptr) 將字元串nptr轉換成長整型數,並返回這個數,錯誤返回0
double strtod(char *str,char **endptr)將字元串str轉換成雙精度數,並返回這個數,
long strtol(char *str,char **endptr,int base)將字元串str轉換成長整型數,
『伍』 c語言的圖形函數庫有哪些
圖形和圖像函數包含在graphics.h裡面
(一) 像素函數
56. putpiel() 畫像素點函數
57. getpixel()返回像素色函數
(二) 直線和線型函數
58. line() 畫線函數
59. lineto() 畫線函數
60. linerel() 相對畫線函數
61. setlinestyle() 設置線型函數
62. getlinesettings() 獲取線型設置函數
63. setwritemode() 設置畫線模式函數
(三)、多邊形函數
64. rectangle() 畫矩形函數
65. bar() 畫條函數
66. bar3d() 畫條塊函數
67. drawpoly() 畫多邊形函數
(四)、 圓、弧和曲線函數
68. getaspectratio()獲取縱橫比函數
69. circle()畫圓函數
70. arc() 畫圓弧函數
71. ellipse()畫橢圓弧函數
72. fillellipse() 畫橢圓區函數
73. pieslice() 畫扇區函數
74. sector() 畫橢圓扇區函數
75. getarccoords()獲取圓弧坐標函數
(五)、 填充函數
76. setfillstyle() 設置填充圖樣和顏色函數
77. setfillpattern() 設置用戶圖樣函數
78. floodfill() 填充閉域函數
79. fillpoly() 填充多邊形函數
80. getfillsettings() 獲取填充設置函數
81. getfillpattern() 獲取用戶圖樣設置函數
(六)、圖像函數
82. imagesize() 圖像存儲大小函數
83. getimage() 保存圖像函數
84. putimage() 輸出圖像函數
四、圖形和圖像函數
對許多圖形應用程序,直線和曲線是非常有用的。但對有些圖形只能靠操作單個像素才能畫出。當然如果沒有畫像素的功能,就無法操作直線和曲線的函數。而且通過大規模使用像素功能,整個圖形就可以保存、寫、擦除和與屏幕上的原有圖形進行疊加。
(一) 像素函數
56. putpixel() 畫像素點函數
功能: 函數putpixel() 在圖形模式下屏幕上畫一個像素點。
用法: 函數調用方式為void putpixel(int x,int y,int color);
說明: 參數x,y為像素點的坐標,color是該像素點的顏色,它可以是顏色符號名,也可以是整型色彩值。
此函數相應的頭文件是graphics.h
返回值: 無
例: 在屏幕上(6,8)處畫一個紅色像素點:
putpixel(6,8,RED);
57. getpixel()返回像素色函數
功能: 函數getpixel()返回像素點顏色值。
用法: 該函數調用方式為int getpixel(int x,int y);
說明: 參數x,y為像素點坐標。
函數的返回值可以不反映實際彩色值,這取決於調色板的設置情況(參見setpalette()函數)。
這個函數相應的頭文件為graphics.h
返回值: 返回一個像素點色彩值。
例: 把屏幕上(8,6)點的像素顏色值賦給變數color。
color=getpixel(8,6);
『陸』 C語言庫函數有哪些,怎麼用
C語言有好幾百個庫函數,使用方法:
用#include命令將包含要使用的庫函數的頭文件包含到自己的程序,然後根據函數原型寫出調用語句或表達式。
『柒』 C語言:如何自己做庫函數
簡單的一個例子,但是基本的程序編譯的思想都在裡面了,具體的需要你自己體會和查資料
跟著下面的步驟走
------------------------
第一步:我的電腦-屬性-高級-環境變數
添加3個變數
1.名字:path 值:vc的安裝目錄裡麵包含cl.exe的bin目錄路徑+";"+vc目錄下包含mspdb80.dll的目錄的路徑
比如我的是D:\Program Files\Microsoft Visual Studio 8\VC\bin;D:\Program Files\Microsoft Visual Studio 8\Common7\IDE;
2.名字:include 值:vc安裝目錄下的include目錄,主要是為了找到頭文件,我的是D:\Program Files\Microsoft Visual Studio 8\VC\include;D:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include;
3.名字:lib 值:vc目錄下包含庫文件的目錄路徑
我的是D:\Program Files\Microsoft Visual Studio 8\VC\lib;D:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib;
第二步:需要下面兩個文件
//-------------libdemo.c
#include <stdio.h>
void lib_func()
{
printf("this routine in lib\n");
}
//------------main.c
void lib_func();
int main(int argc, char *argv[])
{
lib_func();
}
第三步:命令
cl /c libdemo.c '編譯libdemo.c 生成libdemo.obj
lib libdemo.obj '生成libdemo.lib 庫文件
cl /c main.c '編譯main.c
link main.obj libdemo.lib '生成main.exe
---------------------------------------------------
呵呵 加點東西,參看4樓的建議,在做個dll,COM組件就不做了,有點復雜了
1。把libdemo.c 稍微改下
//-------------libdemo.c
#include <stdio.h>
__declspec (dllexport) void lib_func()
{
printf("this routine in lib\n");
}
2。命令
cl /c libdemo.c main.c
link libdemo.obj /dll '生成libdemo.lib
link main.obj libdemo.lib
『捌』 C語言常用的函數有哪些
C語言庫函數,常用庫函數有:
1、scanf格式輸入函數
2、printf格式輸出函數
3、systemdos命令函數
4、sort排序
5、main主函數
6、fgets文件讀取字元串函數
7、fputs文件寫入字元串函數
8、fscanf文件格式讀取函數
9、fprintf文件格式寫入函數
10、fopen打開文件函數
11、getchar輸入字元函數
12、putchar輸出字元函數
13、malloc動態申請內存函數
14、free釋放內存函數
15、abs求絕對值數學函數
16、sqrt求平方根數學函數
(8)c語言在線函數庫擴展閱讀
語言組成:
1、數據類型
C的數據類型包括:整型、字元型、實型或浮點型(單精度和雙精度)、枚舉類型、數組類型、結構體類型、共用體類型、指針類型和空類型。
2、常量與變數
常量其值不可改變,符號常量名通常用大寫。
變數是以某標識符為名字,其值可以改變的量。標識符是以字母或下劃線開頭的一串由字母、數字或下劃線構成的序列,請注意第一個字元必須為字母或下劃線,否則為不合法的變數名。變數在編譯時為其分配相應存儲單元。
3、數組
如果一個變數名後面跟著一個有數字的中括弧,這個聲明就是數組聲明。字元串也是一種數組。它們以ASCII的NULL作為數組的結束。要特別注意的是,方括內的索引值是從0算起的。
4、指針
如果一個變數聲明時在前面使用 * 號,表明這是個指針型變數。換句話說,該變數存儲一個地址,而 *(此處特指單目運算符 * ,下同。C語言中另有 雙目運算符 *) 則是取內容操作符,意思是取這個內存地址里存儲的內容。指針是 C 語言區別於其他同時代高級語言的主要特徵之一。
『玖』 C語言中的頭文件有多少種都有哪些C函數庫有哪些
iv_t和lldiv_t;宏例如EXIT_FAILURE、EXIT_SUCCESS、RAND_MAX和MB_CUR_MAX等等;
常見的函數有malloc()、calloc()、realloc()、free()、system()、atoi()、atol()、rand()、srand()、exit()等。具體內容可以在編譯器的包含目錄stdlib.h頭文件中打開查看。
為了方便用戶編寫程序,C語言為用戶開發了大量的庫函數,定義在。H文件,用戶可以調用這些函數來實現強大的功能。因此,對於用戶來說,這些函數的使用是提高編程水平的關鍵。
(9)c語言在線函數庫擴展閱讀:
以下內容適用於頭文件
1.對於具有外部存儲類型的標識符,可以在任何其他源程序文件中聲明後引用它們,這樣用戶就可以完全將具有外部存儲類型的標識符的一些聲明放在頭文件中。
2.具體來說,頭文件可以包括用戶構造的數據類型(例如枚舉類型)、外部變數、外部函數、常量和具有一定通用性或公共量的內聯函數。一般的變數和函數定義不應該放在頭文件中。
其他:
雙假設(雙x,雙y);//給定一個直角三角形的兩條邊的長度,求斜邊的長度。
雙ldexp(雙x,int指數);//計算x*(2的指數次方)。
雙poly(Doublex,intdegree,Doublecoeffs[])//計算多項式。
Ntmatherr(structexception*e)//數學錯誤計算處理程序。
『拾』 C 語言標准庫函數
C語言標准庫函數
標准io函數
Standard C I/O
clearerr() clears errors
fclose() close a file
feof() true if at the end-of-file
ferror() checks for a file error
fflush() writes the contents of the output buffer
fgetc() get a character from a stream
fgetpos() get the file position indicator
fgets() get a string of characters from a stream
fopen() open a file
fprintf() print formatted output to a file
fputc() write a character to a file
fputs() write a string to a file
fread() read from a file
freopen() open an existing stream with a different name
fscanf() read formatted input from a file
fseek() move to a specific location in a file
fsetpos() move to a specific location in a file
ftell() returns the current file position indicator
fwrite() write to a file
getc() read a character from a file
getchar() read a character from STDIN
gets() read a string from STDIN
perror() displays a string version of the current error to STDERR
printf() write formatted output to STDOUT
putc() write a character to a stream
putchar() write a character to STDOUT
puts() write a string to STDOUT
remove() erase a file
rename() rename a file
rewind() move the file position indicator to the beginning of a file
scanf() read formatted input from STDIN
setbuf() set the buffer for a specific stream
setvbuf() set the buffer and size for a specific stream
sprintf() write formatted output to a buffer
sscanf() read formatted input from a buffer
tmpfile() return a pointer to a temporary file
tmpnam() return a unique filename
ungetc() puts a character back into a stream
vprintf, vfprintf, vsprintf write formatted output with variable argument lists
標准字元/字元串處理函數
atof() converts a string to a double
atoi() converts a string to an integer
atol() converts a string to a long
isalnum() true if alphanumeric
isalpha() true if alphabetic
iscntrl() true if control character
isdigit() true if digit
isgraph() true if a graphical character
islower() true if lowercase
isprint() true if a printing character
ispunct() true if punctuation
isspace() true if space
isupper() true if uppercase character
isxdigit() true if a hexidecimal character
memchr() searches an array for the first occurance of a character
memcmp() compares two buffers
memcpy() copies one buffer to another
memmove() moves one buffer to another
memset() fills a buffer with a character
strcat() concatenates two strings
strchr() finds the first occurance of a character in a string
strcmp() compares two strings
strcoll() compares two strings in accordance to the current locale
strcpy() copies one string to another
strcspn() searches one string for any characters in another
strerror() returns a text version of a given error code
strlen() returns the length of a given string
strncat() concatenates a certain amount of characters of two strings
strncmp() compares a certain amount of characters of two strings
strncpy() copies a certain amount of characters from one string to another
strpbrk() finds the first location of any character in one string, in another string
strrchr() finds the last occurance of a character in a string
strspn() returns the length of a substring of characters of a string
strstr() finds the first occurance of a substring of characters
strtod() converts a string to a double
strtok() finds the next token in a string
strtol() converts a string to a long
strtoul() converts a string to an unsigned long
strxfrm() converts a substring so that it can be used by string comparison functions
tolower() converts a character to lowercase
toupper() converts a character to uppercase
標准數學函數
abs() absolute value
acos() arc cosine
asin() arc sine
atan() arc tangent
atan2() arc tangent, using signs to determine quadrants
ceil() the smallest integer not less than a certain value
cos() cosine
cosh() hyperbolic cosine
div() returns the quotient and remainder of a division
exp() returns "e" raised to a given power
fabs() absolute value for floating-point numbers
floor() returns the largest integer not greater than a given value
fmod() returns the remainder of a division
frexp() decomposes a number into scientific notation
labs() absolute value for long integers
ldexp() computes a number in scientific notation
ldiv() returns the quotient and remainder of a division, in long integer form
log() natural logarithm
log10() natural logarithm, in base 10
modf() decomposes a number into integer and fractional parts
pow() returns a given number raised to another number
sin() sine
sinh() hyperbolic sine
sqrt() square root
tan() tangent
tanh() hyperbolic tangent
標准時間/日期函數
asctime() a textual version of the time
clock() returns the amount of time that the program has been running
ctime() returns a specifically formatted version of the time
difftime() the difference between two times
gmtime() returns a pointer to the current Greenwich Mean Time
localtime() returns a pointer to the current time
mktime() returns the calendar version of a given time
strftime() returns indivial elements of the date and time
time() returns the current calendar time of the system
標准內存管理函數
calloc() allocates a two-dimensional chunk of memory
free() makes memory available for future allocation
malloc() allocates memory
realloc() changes the size of previously allocated memory
其它標准函數
abort() stops the program
assert() stops the program if an expression isn';t true
atexit() sets a function to be called when the program exits
bsearch() perform a binary search
exit() stop the program
getenv() get enviornment information about a variable
longjmp() start execution at a certain point in the program
qsort() perform a quicksort
raise() send a signal to the program
rand() returns a pseudorandom number
setjmp() set execution to start at a certain point
signal() register a function as a signal handler
srand() initialize the random number generator
system() perform a system call
va_arg() use variable length parameter lists