鱼C论坛

 找回密码
 立即注册
查看: 5525|回复: 14

[已解决]关于Dev-C++:编译器中数串前缀0f会显示为紫色

[复制链接]
发表于 2022-12-29 22:43:48 | 显示全部楼层    本楼为最佳答案   
显示的那个颜色并不意味着什么,只是为了方便你看程序

标准没有规定二进制,有的编译器可以使用0b前缀
下面的程序gcc没问题,其他编译器没试过
  1. sh-5.1$ cat main.c
  2. #include <stdio.h>

  3. int main(void) {
  4.     printf("%d\n", 0b10010110);
  5.     return 0;
  6. }
  7. sh-5.1$ gcc --version
  8. gcc (GCC) 12.2.0
  9. Copyright (C) 2022 Free Software Foundation, Inc.
  10. This is free software; see the source for copying conditions.  There is NO
  11. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

  12. sh-5.1$ gcc -g -Wall -o main main.c
  13. sh-5.1$ ./main
  14. 150
  15. sh-5.1$
复制代码


参考
https://blog.csdn.net/nibiewuxuanze/article/details/7842660
https://www.cnblogs.com/Martinium/p/binary_literal.html
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-9-24 10:00

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表