摘要: 函数名与函数指针一 通常的函数调用 一个通常的函数调用的例子:#include <iostream>using std::cout;using std::endl;void MyFun(int x); //此处也可以声明为:void Myfun(int); int main(){ MyFun(10); //这里是调用MyFun(int x);函数 system("pause"); return 0;}void MyFun(int x) { cout << "x: " << x << endl;} 这个MyF 阅读全文
posted @ 2012-05-29 18:22 waynewuzhenbo 阅读(979) 评论(0) 推荐(0) 编辑
摘要: 指针是C/C++语言的特色,而数组名与指针有太多的相似,甚至很多时候,数组名可以作为指针使用。于是乎,很多程序设计者就被搞糊涂了。魔幻数组名请看程序(本文程序在WIN32平台下编译):#include <iostream>using namespace std;int main(){ char str[10]; char* pStr = str; cout << "sizeof(str): \t" << sizeof(str) << endl; cout << "sizeof(pStr): \t" 阅读全文
posted @ 2012-05-29 12:47 waynewuzhenbo 阅读(5594) 评论(1) 推荐(3) 编辑
摘要: 关于C++语言中return的一些总结 return是C++预定义的语句,它提供了种植函数执行的一种放大。当return语句提供了一个值时,这个值就成为函数的返回值。 说到return,有必要提及主函数的定义,对了解主函数中返回值的理解有很大的帮助。很多人甚至市面上的一些书籍,都使用了void main( ) ,其实这是错误的。C/C++ 中从来没有定义过void main( ) 。C++ 之父 Bjarne Stroustrup 在他的主页上的 FAQ 中明确地写着 The definition void main( ) { /* ... */ } is not and never h... 阅读全文
posted @ 2012-05-29 00:20 waynewuzhenbo 阅读(654) 评论(0) 推荐(0) 编辑