# include <stdio.h> # include <inttypes.h> /* altnames.c -- 可移植的整数类型名 */ /* 时间:2018年06月05日 23:24:01 代码:程序清单3.6_altnames.c程序_《C Primer Plus》P47 目的:加头文件 #inlcude <inttypes.h> */ int main(void) { int16_t me16; me16 = 4593; printf("First, assume int16_t is short: "); printf("me16 = %hd\n", me16); printf("Next, let's not make any assumptions.\n"); printf("Instead, use a \"macro\" from inttypes.h: "); printf("me16 = %" PRId16 "\n", me16); return 0; } /* 在DevC++_5.11中运行结果: ---------------------------------------------------- First, assume int16_t is short: me16 = 4593 Next, let's not make any assumptions. Instead, use a "macro" from inttypes.h: me16 = 4593 ----------------------------------------------------- google翻译如下: 首先,假设int16_t很短:me16 = 4593 接下来,我们不要做任何假设。 相反,使用inttypes.h中的"宏":me16 = 4593 ----------------------------------------------------- 总结: 本人对这一段程序还不甚了解其用意,有待进一步了 解。另外,在VS2010中添加头文件 #include "inttypes.h" 编译失败,待查中.......... 下载了 inttypes.h 文件复件到: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include 在未重启的情况下,编译仍失败,待查中...... ----------------------------------------------------- */
程序清单3.6_altnames.c程序_《C Primer Plus》P47
猜你喜欢
转载自blog.51cto.com/13555061/2125324
今日推荐
周排行