面向对象的程序设计c++解说演示课件.pptVIP

  • 5
  • 0
  • 约7.86千字
  • 约 43页
  • 2018-03-28 发布于广东
  • 举报

面向对象的程序设计c++解说演示课件.ppt

. . 内存分配 /* To free a 2_dimension dynamic array */ void CMyLib::ffree_2d(void **a,int row) { int i; if(a==NULL) return ; for(i=0;irow;i++) free(a[i]); free(a); a = NULL; } . 作业:一维/二维指针复用 二维指针/一维指针转换——内存复用 . . 指针访问 二维指针与一维指针转换 void ** CMyLib::fspace_2d1(int row, int col, int lenth) { int i; void **b; void *pp; b = (void **)calloc(sizeof(void *),row); pp = (void *)calloc(lenth,row*col); for(i=0;irow;i++) { b[i] = (void*) ((BYTE*)pp + i*col*lenth); //???? } return(b); } // 如何释放? TestCodes\ch2\Test2b\Test2b.dsw fspace2D.dsw // 简化版 . C++的函数 (1) 设置函数参数的缺省值 c++容

文档评论(0)

1亿VIP精品文档

相关文档