日期:2014-05-17  浏览次数:20612 次

数组如何申明?
#include <windows.h>
#pragma comment(linker, "/OPT:NOWIN98")
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )
void main()
{
unsigned char PIShellCode[n] =
{
/数组
};

_asm
{
lea eax,_black
call eax
}
}

编译失败..
--------------------Configuration: Cpp4 - Win32 Debug--------------------
Compiling...
Cpp4.cpp
f:\cpp4.cpp(7) : error C2065: 'n' : undeclared identifier
f:\cpp4.cpp(7) : error C2057: expected constant expression
f:\cpp4.cpp(7) : error C2466: cannot allocate an array of constant size 0
执行 cl.exe 时出错.

Cpp4.obj - 1 error(s), 0 warning(s)

请问为什么会这样?

------解决方案--------------------
接分了,
楼上说得对,
还有问错地方了,好像
------解决方案--------------------
探讨

f:\cpp4.cpp(7) : error C2065: 'n' : undeclared identifier

这一句不是说得很清楚了,c\c++中声明数组时需要指定固定长度,这里的n没有定义啥,谁知道楼主这个n是多长,数组初始化时要分配多少空间