<assert.h>
#include <assert.h>
#include <stdio.h>
int main()
{
int a;
char str[50];
printf("请输入一个整数值: ");
scanf("%d", &a);
assert(a >= 10);
printf("输入的整数是: %d\n", a);
printf("请输入字符串: ");
scanf("%s", str);
assert(str != NULL);
printf("输入的字符串是: %s\n", str);
return(0);
}
<ctype.h>
C 标准库的 ctype.h 头文件提供了一些函数,可用于测试和映射字符。
这些函数接受 int 作为参数,它的值必须是 EOF 或表示为一个无符号字符。
如果参数 c 满足描述的条件,则这些函数返回非零(true)。如果参数 c 不满足描述的条件,则这些函数返回零。
int isalnum(int c);#该函数检查所传的字符是否是字母和数字。
int isalpha(int c)#该函数检查所传的字符是否是字母。
int iscntrl(int c)
int isdigit(int c)
int isgraph(int c)
int islower(int c)
int isxdigit(int c)
int isupper(int c)
...
int tolower(int c)//该函数把大写字母转换为小写字母。
int toupper(int c)//该函数把小写字母转换为大写字母。
<errno.h>
extern int errno//这是通过系统调用设置的宏,在错误事件中的某些库函数表明了什么发生了错误。errno是一个错误号 使用strerror(errno)可以输出该错误的描述
EDOM Domain Error//这个宏表示一个域错误,它在输入参数超出数学函数定义的域时发生,errno 被设置为 EDOM。
ERANGE Range Error//这个宏表示一个范围错误,它在输入参数超出数学函数定义的范围时发生,errno 被设置为 ERANGE。
<float.h>
要素过多
<limits.h>
limits.h 头文件决定了各种变量类型的各种属性。定义在该头文件中的宏限制了各种变量类型(比如 char、int 和 long)的值。 这里较为重要第一次知道,
这些限制指定了变量不能存储任何超出这些限制的值,例如一个无符号可以存储的最大值是 255。
#include <stdio.h>
#include <limits.h>
int main()
{
printf("The number of bits in a byte %d\n", CHAR_BIT);
printf("The minimum value of SIGNED CHAR = %d\n", SCHAR_MIN);
printf("The maximum value of SIGNED CHAR = %d\n", SCHAR_MAX);
printf("The maximum value of UNSIGNED CHAR = %d\n", UCHAR_MAX);
printf("The minimum value of SHORT INT = %d\n", SHRT_MIN);
printf("The maximum value of SHORT INT = %d\n", SHRT_MAX);
printf("The minimum value of INT = %d\n", INT_MIN);
printf("The maximum value of INT = %d\n", INT_MAX);
printf("The minimum value of CHAR = %d\n", CHAR_MIN);
printf("The maximum value of CHAR = %d\n", CHAR_MAX);
printf("The minimum value of LONG = %ld\n", LONG_MIN);
printf("The maximum value of LONG = %ld\n", LONG_MAX);
return(0);
}
The number of bits in a byte 8
The minimum value of SIGNED CHAR = -128
The maximum value of SIGNED CHAR = 127
The maximum value of UNSIGNED CHAR = 255
The minimum value of SHORT INT = -32768
The maximum value of SHORT INT = 32767
The minimum value of INT = -2147483648
The maximum value of INT = 2147483647
The minimum value of CHAR = -128
The maximum value of CHAR = 127
The minimum value of LONG = -9223372036854775808
The maximum value of LONG = 9223372036854775807
<locale.h>
要素很多,用于设置不同地区时间,地域化的信息
<math.h>
math.h 头文件定义了各种数学函数和一个宏。在这个库中所有可用的功能都带有一个 double 类型的参数,且都返回 double 类型的结果。
double acos(double x)//返回以弧度表示的 x 的反余弦。
double sqrt(double x)
double ceil(double x)
double fabs(double x)
...
<setjmp.h>
<signal.h>
<stdarg.h>
<stddef.h>
<stdio.h>
<stdlib.h>
<string.h>
<time.h>