当前位置:网站首页>C和指针 第1章 词法“陷阱” 1.4 整型常量
C和指针 第1章 词法“陷阱” 1.4 整型常量
2022-07-20 11:21:00 【weixin_客子光阴】
/*
*八进制数:一个整型常量的第一个字符是数字0。
*易错点:有时候在上下文中为了格式对齐的需要,可能无意中将十进制数写成了八进制数。
*/
/*
*0195表示1 * 8^2 + 9 * 8^1 + 5 * 8^0。ANSI标准也禁止这种用法。
*八进制的有效字符为0,1,2,3,4,5,6,7
*/
#include <stdio.h>
#include <stdlib.h>
struct {
int part_number;
const char *description;
} parttab[] = {
046, "left-handed widget", /*八进制数*/
047, "right-handed widget",
125, "frammis" /*十进制数*/
};
int main( void ) {
for (int i = 0; i < 3; ++i) {
printf("parttab[%d] = %d\n", i, parttab[i].part_number);
}
printf("\n");
return EXIT_SUCCESS;
}
/* 输出:
*/
边栏推荐
猜你喜欢
动态内存管理(malloc,free,calloc,realloc,柔性数组)
使用ECS和OSS搭建个人网盘
ECCV 2022 | Kuangshi proposed a semi supervised target detection model, dense teacher, which achieved SOTA performance
NAT 的几种应用场景
Tensorflow network model migration based on tensorflow gpu2ascend tool
抽丝剥茧C语言(高阶)文件操作+练习
【Flutter -- 基础组件】图片组件 Image & Icon
深入理解Mysql事务隔离级别与锁机制
阿里云负载均衡实验 2022年7月11日
【Flutter -- 顶部导航栏】TabBarView 的基本使用
随机推荐
How to return the first address of an array through a function
[shutter -- basic component] text component text & TextStyle & textspan
[computer gadget recommendation] sedentary reminder
Jackson dynamically filters attributes, and programmatically filters attributes in objects
Video analysis streameye studio
网络 与vpc实验
动作活体检测能力,构建安全可靠的支付级“刷脸”体验
元宇宙中DeFi的可能性和局限性
Iron nails pierce the head, yogurt bottles "bite" the tongue... Guangdong fire: Summer children's safety can not be ignored
Use ECs and OSS to set up personal network disk
General GUI large disk based on MCU
How to download video files
Network and VPC experiment
CSRF攻击原理场景
ARM64 内存64位宽与32位位宽 速度对比
Use easyexcel to read and write
阿里云负载均衡实验 2022年7月11日
Communication tutorial | USB, HDMI, DP interface and speed
【Flutter -- 基础组件】AppBar 的使用
DDR 6 memory has been put into research and development