c语言基本函数名 c语言函数名称的命名规则( 四 )


9、break:跳出当前循环或switch结构 。
10、goto:无条件跳转语句 。
11、if:条件语句,后面不需要放分号 。
12、else:条件语句否定分支(与if连用) 。
13、switch:开关语句(多重分支语句) 。
14、case:开关语句中的分支标记,与switch连用 。
15、default:开关语句中的“其他”分支 , 可选 。
常用函数:
1、int isalpha(int ch) 若ch是字母('A'-'Z','a'-'z'),返回非0值,否则返回0 。
2、int isalnum(int ch) 若ch是字母('A'-'Z','a'-'z')或数字('0'-'9'),返回非0值,否则返回0 。
3、int abs(int i) 返回整型参数i的绝对值 。
4、double cabs(struct complex znum) 返回复数znum的绝对值 。
5、double fabs(double x) 返回双精度参数x的绝对值 。
6、long labs(long n) 返回长整型参数n的绝对值 。
参考资料来源:百度百科—C语言
求C语言函数大全函数名: abort
功能: 异常终止一个进程
用法: void abort(void);
程序例:
#include stdio.h
#include stdlib.h
int main(void)
{
printf("Calling abort()\n");
abort();
return 0; /* This is never reached */
}
函数名: abs
功能: 求整数的绝对值
用法: int abs(int i);
程序例:
#include stdio.h
#include math.h
int main(void)
{
int number = -1234;
printf("number: %dabsolute value: %d\n", number, abs(number));
return 0;
}
函数名: absread, abswirte
功能: 绝对磁盘扇区读、写数据
用法: int absread(int drive, int nsects, int sectno, void *buffer);
int abswrite(int drive, int nsects, in tsectno, void *buffer);
程序例:
/* absread example */
#include stdio.h
#include conio.h
#include process.h
#include dos.h
int main(void)
{
int i, strt, ch_out, sector;
char buf[512];
printf("Insert a diskette into drive A and press any key\n");
getch();
sector = 0;
if (absread(0, 1, sector, buf) != 0)
{
perror("Disk problem");
exit(1);
}
printf("Read OK\n");
strt = 3;
for (i=0; i80; i++)
{
ch_out = buf[strt+i];
putchar(ch_out);
}
printf("\n");
return(0);
}
函数名: access
功能: 确定文件的访问权限
用法: int access(const char *filename, int amode);
程序例:
#include stdio.h
#include io.h
int file_exists(char *filename);
int main(void)
{
printf("Does NOTEXIST.FIL exist: %s\n",
file_exists("NOTEXISTS.FIL") ? "YES" : "NO");
return 0;
}
int file_exists(char *filename)
{
return (access(filename, 0) == 0);
}
函数名: acos
功能: 反余弦函数
用法: double acos(double x);
程序例:
#include stdio.h
#include math.h
int main(void)
{
double result;
double x = 0.5;
result = acos(x);
printf("The arc cosine of %lf is %lf\n", x, result);
return 0;
}
函数名: allocmem
功能: 分配DOS存储段
用法: int allocmem(unsigned size, unsigned *seg);
程序例:
#include dos.h
#include alloc.h
#include stdio.h
int main(void)
{
unsigned int size, segp;
int stat;
size = 64; /* (64 x 16) = 1024 bytes */
stat = allocmem(size, segp);
if (stat == -1)
printf("Allocated memory at segment: %x\n", segp);
else
printf("Failed: maximum number of paragraphs available is %u\n",
stat);
return 0;
}
函数名: arc
功能: 画一弧线
用法: void far arc(int x, int y, int stangle, int endangle, int radius);
【c语言基本函数名 c语言函数名称的命名规则】

推荐阅读