⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_26532.htm

📁 vc
💻 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>&nbsp;&nbsp;&nbsp;&nbsp; ..............................<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .............................<BR>&nbsp;&nbsp;&nbsp;&nbsp; extern int* a;<BR><BR>i do like this way, but always get exception in reading the array contents. <BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<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>&nbsp;&nbsp; a=new int[320*240];<BR>&nbsp;&nbsp; .....<BR>}<BR><BR><BR>in other.cpp<BR><BR>extern int *a;<BR><BR>int foo()<BR>{<BR>&nbsp;&nbsp; //use a[i]<BR>&nbsp;&nbsp; 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>&nbsp;&nbsp;<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 + -