C++(基础)———— c和c++的区别(一)

一、函数参数的默认值 C语言: 众所周知c语言的函数参数是没有默认值的。 c++: 1、 参数默认值的赋值: 1、必须从右向左,依次赋默认值 2、不可对函数参数重复赋默认值 代码示例如下: #include<iostream> using namespace std; //int fun(int a, int b = 30,int c);//error,参数3缺少默认值 i
相关文章
相关标签/搜索