【发布时间】:2011-07-28 19:22:31
【问题描述】:
我试图声明一个字节数组,以便我可以遍历它们并单独使用它们中的每一个。这是数组
const BYTE keybyte[] = {
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57 0x58,
0x59, 0x5A, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
0x36, 0x37, 0x38, 0x39, 0x25, 0x27, 0x26, 0x28,
0x0D, 0x20, 0x10, 0x11, 0x12, 0x18};
由于某种原因,当我编译时它给了我这些错误:/
error C2143: syntax error : missing '}' before 'constant'
error C2143: syntax error : missing ';' before 'constant'
error C2059: syntax error : 'constant'
error C2143: syntax error : missing ';' before '}'
error C2059: syntax error : '}'
我不明白,因为如果我将其替换为
const BYTE keybyte[] = {0,0,0,0};
它工作得很好,没有错误:/?
【问题讨论】:
标签: c++ arrays syntax constants byte