C++ Primer(第5版) 练习 6.23
练习 6.23 参考本节介绍的几个print函数,根据理解编写你自己的版本。依次调用每个函数使其输入下面定义的i和j:
int i = 0, j[2] = {0, 1};
环境:Linux Ubuntu(云服务器)
工具:vim
代码块
/*************************************************************************> File Name: ex6.23.cpp> Author: > Mail: > Created Time: Tue 13 Feb 2024 03:47:20 PM CST************************************************************************/#include<iostream>
using namespace std;void print(const int *n){cout<<*n<<endl;
}void print1(const int *beg, const int *end){while(beg != end){cout<<*beg++<<endl;}
}int main(){int i = 0, j[2] = {0, 1};print(&i);print(j);print1(begin(j), end(j));return 0;
}