【发布时间】:2016-02-08 21:01:38
【问题描述】:
我正在尝试创建一个程序,该程序将输出 16 个数字的二进制代码。这是我目前所拥有的:
#include <stdio.h>
#include <stdlib.h>
int i;
int count;
int mask;
int i = 0xF5A2;
int mask = 0x8000;
int main()
{
printf("Hex Value= %x Binary= \n", i);
{
for (count=0; count<15; count++1)
{
if (i&mask)
printf("1\n");
else
printf("0\n");
}
(mask = mask>>1);
}
return 0;
}
错误:
|16|error: expected ')' before numeric constant|
如果我有任何其他错误,请告诉我,提前谢谢!
【问题讨论】:
-
哇,我很抱歉它在数字常量之前是“预期的')'”
-
count++1-->count++。也(mask = mask>>1);进入 for 循环 -
好的,现在没有错误,但它只给了我 16 个 1,没有二进制代码或任何东西
-
count<15-->count<16
标签: c binary constants codeblocks numeric