在c++中是不允许数组作为函数的返回值的 

int [] someFunction( ); //ILLEGAL 

要想实现函数返回一个数组,那返回对应数组里面类型的指针

you must return a pointer to the array base type and have the pointer point to the array. So, the function declaration would be as follows:
int* someFunction( ); //Legal int* doubler( int a[], int size)
{
int* temp = new int[size];
for ( int i =; i < size; i++)
temp[i] = *a[i];
return temp;
} 调用 int a[] = {, , , , };
int* b;
b = doubler(a, ); delete[] b

最新文章

  1. 修改Eclipse的 workspace目录
  2. Linux用户切换
  3. 手把手教你调试Linux C++ 代码(一步到位包含静态库和动态库调试)
  4. Metatable让我从心认知了Lua(相知篇)
  5. Linux系统文件访问控制列表
  6. 使用struts taglib导致java.lang.NullPointerException: Module &#39;null&#39; not found.
  7. CXF之五 拦截器Interceptor
  8. cocos2d-x 纹理源码分析
  9. 单点登录CAS使用记(七):关于服务器超时以及客户端超时的分析
  10. C# 初识Ref和Out
  11. foreach的用法(转)
  12. 大道至简第一章观后感——java伪代码
  13. oracle导入dmp文件的2种方法
  14. android 常用方法集合
  15. 使用tp访问数据库时提示错误: &#39;PDO&#39; not found, 和not defined constant mysql_attr_init_command 和call an undefined function Think\Template\simpleXml_load_string()函数
  16. 性能测试LR学习笔录 -2
  17. WebGL和ThreeJs学习5--ThreeJS基本功能控件
  18. 人工智能有简单的算法吗?Appendix: Is there a simple algorithm for intelligence?
  19. 如何成为java架构师(转载)
  20. Mercedes BENZ C5 SD Connect Xentry Tab Kit Technical Support

热门文章

  1. CDH 不能监控hadoop状态
  2. Android Material Design:基于CoordinatorLayout实现向上滚动导航条ToolBar滚出、向下滚动导航条滚出
  3. 获取月份对应的day
  4. GetProperties(BindingFlags)说明
  5. 使用WIF实现单点登录Part II —— Windows Identity Foundation基本原理
  6. UCOS2_STM32F1移植详细过程(二)
  7. wpf 动画 2个窗体切换
  8. static 与 final 修饰符
  9. Java求职面试准备之常见算法
  10. 在.net程序中使用System.Net.Mail来发送邮件