摘要: 函数返回指针和返回数组名有什么区别先看一个例子:#include<iostream>usingnamespace std;char *fun(void){char *p="hello the world"; char buffer[] = "hello the world";return p; //这里为什么可以返回局部定义的指针?// return buffer; //这里为什么不可以返回局部定义的数组名?}int main(void){char *s;s=fun();printf("%s\n",s);return 0; 阅读全文
posted @ 2012-09-15 02:41 CBDoctor 阅读(1527) 评论(0) 推荐(1)
摘要: 先看下面的一段代码: 1 #include "stdafx.h" 2 #include <iostream> 3 using namespace std; 4 struct A 5 { 6 void func1() 7 { 8 cout<<"A::func1()"<<endl; 9 }10 };11 struct B: public A12 {13 void func1()14 {15 cout<<"B::func1()"<<endl;16 }17 };18 struct C 阅读全文
posted @ 2012-09-15 01:49 CBDoctor 阅读(343) 评论(0) 推荐(0)