标准c字符和字符串库函数.docVIP

  • 1
  • 0
  • 约2.62万字
  • 约 21页
  • 2019-09-19 发布于安徽
  • 举报
标准c字符和字符串 atof 语法: ? #include stdlib.h double atof( const char *str ); 功能:将字符串str转换成一个双精度数值并返回结果。 参数str 必须以有效数字开头,但是允许以“E”或“e”除外的任意非数字字符结尾。例如: x = atof( 42.0is_the_answer ); x的值为42.0. 相关主题: atoi() and atol(). atoi 语法: ? #include stdlib.h int atoi( const char *str ); 功能:将字符串str转换成一个整数并返回结果。参数str 以数字开头,当函数从str 中读到非数字字符则结束转换并将结果返回。例如, i = atoi( 512.035 ); i 的值为 512. 相关主题: atof() and atol(). atol 语法: ? #include stdlib.h long atol( const char *str ); 功能:将字符串转换成长整型数并返回结果。函数会扫描参数str字符串,跳过前面的空格字符,直到遇上数字或正负符号才开始做转换,而再遇到非数字或字符串结束时才结束转换,并将结果返回。例如, x = atol( 1024.0001 ); x的值为1024L. 相关主题: atof() and atoi(). isalnum 语法: ? #include ctype.h int isalnum( int ch ); 功能:如果参数是数字或字母字符,函数返回非零值,否则返回零值。 char c; scanf( %c, c ); if( isalnum(c) ) printf( You entered the alphanumeric character %c\n, c ); 相关主题: isalpha(), iscntrl(), isdigit(), isgraph(), isprint(), ispunct(), and isspace(). isalpha 语法: ? #include ctype.h int isalpha( int ch ); 功能:如果参数是字母字符,函数返回非零值,否则返回零值。 char c; scanf( %c, c ); if( isalpha(c) ) printf( You entered a letter of the alphabet\n ); 相关主题: isalnum(), iscntrl(), isdigit(), isgraph(), isprint(), ispunct(), and isspace(). iscntrl 语法: ? #include ctype.h int iscntrl( int ch ); 功能:如果参数是控制字符(0和0x1F之间的字符,或者等于0x7F)函数返回非零值,否则返回零值。 相关主题: isalnum(), isalpha(), isdigit(), isgraph(), isprint(), ispunct(), and isspace(). isdigit 语法: ? #include ctype.h int isdigit( int ch ); 功能:如果参数是0到9之间的数字字符,函数返回非零值,否则返回零值. char c; scanf( %c, c ); if( isdigit(c) ) printf( You entered the digit %c\n, c ); 相关主题: isalnum(), isalpha(), iscntrl(), isgraph(), isprint(), ispunct(), and isspace(). isgraph 语法: ? #include ctype.h int isgraph( int ch ); 功能:如果参数是除空格外的可打印字符(可见的字符),函数返回非零值,否则返回零值。 相关主题: isalnum(), isalpha(), iscntrl(), isdigit(), isprint(), ispunct(), and isspace(). islower 语法: ? #include ctype.h int islower( int

文档评论(0)

1亿VIP精品文档

相关文档