summaryrefslogtreecommitdiff
path: root/3p35.cpp
blob: 9115568176c00f4289da00b48f743f257bf81867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <vector>
#include <iterator>

/*
 *
 * 3.35
 *
 *
 */

int main () {

	int ia[50]; // We make it uninitialized and print it so we can easily see before and after
	for(auto r : ia) {
		std::cout << r << " ";
	}

	std::cout << std::endl;
	/*
	// Different loops we can use, commented out here is using a while loop
	// And uncommented further below is using a for loop
	
	auto p_begin = std::begin(ia);
	auto p_end = std::end(ia);
	while(p_begin != p_end) {
		*p_begin = 0;
		++p_begin;
	}
	*/
	for(auto p_beg = std::begin(ia) ; p_beg != std::end(ia) ; ++p_beg) {
		*p_beg = 0;
	}
	
	for(auto r : ia) {
		std::cout << r << " ";
	}
	
	std::cout << std::endl;
	return 0;
}