演示版本

VS2013

  • toascii()函数

toascii函数用于把一个非ASCII字符转换成ASCII码,其实就是把八位二进制数的最高位变成0。

语法

int toascii(int ch);

toascii函数的语法参数说明如下:

参数ch为待转换的字符。

toascii函数的返回值:转换后的字符。

示例

本示例演示用toascii函数把一个非ASCII字符转换为ASCII码。其具体代码如下:

#include <stdio.h>
#include <ctype.h>

int main()
{
    int ch1, ch2;
    ch1 = 'a' + 128;
    ch2 = toascii(ch1);//转换为ASCII字符
    printf("transform %c to %c\n", ch1, ch2);

    return 0;
}

C语言常用函数-toascii()将字符转换为ASCII码函数

 

阿飞

2021年7月27日

相关文章:

  • 2022-12-23
  • 2021-04-15
  • 2022-12-23
  • 2021-11-09
  • 2021-12-18
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-15
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-12-04
相关资源
相似解决方案