📄 subject_26532.htm
字号:
<p>
序号:26532 发表者:apple_caro 发表日期:2003-01-02 13:50:31
<br>主题:extern int*? correct??
<br>内容: <BR>I know how to use extern int a, <BR><BR>But how to use a external array , let's say int* a?<BR>e.g. int* a= new int[320*240];<BR> ..............................<BR> .............................<BR> extern int* a;<BR><BR>i do like this way, but always get exception in reading the array contents. <BR><BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:bb 回复日期:2003-01-02 13:58:12
<br>内容:do as this<BR>for example:<BR>in main.cpp<BR><BR>int *a=NULL;<BR><BR>void main()<BR>{<BR> a=new int[320*240];<BR> .....<BR>}<BR><BR><BR>in other.cpp<BR><BR>extern int *a;<BR><BR>int foo()<BR>{<BR> //use a[i]<BR> int b=a[30];<BR>}<BR><BR><BR>your problem;<BR><BR>int* a= new int[320*240];<BR>This sentence is not in any function, so "new" operator is not be run and int *a also not be iniatlized.<BR> <BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -