编写一段程序,利用指针将数组中的元素置为0
#include <iostream> #include <iterator> using namespace std; int main() { int a[]={1,2,3,4,5,6,7,8}; int *p=begin(a); int *p1=end(a); for (*p;p!=p1;*p++){ *p=0; } for(auto c:a) cout<<c<<endl; return 0; }