摘要:
代码1const int size = 9;char c[size];1.VS2005 编译为 C 代码(/TC)编译不通过错误1error C2057: expected constant expression错误2error C2466: cannot allocate an array of constant size 0错误3error C2133: 'c' : unknown size2.VS2005 编译为 C++ 代码(/TP)编译通过3.Cygwin gcc/g++编译通过============================================= 阅读全文
posted @ 2012-10-01 17:54
bigbigtree
阅读(690)
评论(0)
推荐(0)
摘要:
第九节 默认参数的函数1.默认参数的目的 C++可以给函数定义默认参数值。通常,调用函数时,要为函数的每个参数给定对应的实参。例如: void delay(int loops); //函数声明 void delay(int loops) //函数定义 { if(100ps==0) return; for(int i=0;i<loops,i++); } 无论何时调用delay()函数,都必须给loops传一个值以确定时间。但有时需要用相同的实参反复调用delay()函数。C++可以给参数定义默认值。如果将delay( )函数中的loops定... 阅读全文
posted @ 2012-10-01 10:46
bigbigtree
阅读(7894)
评论(0)
推荐(0)

浙公网安备 33010602011771号