How to declare, uninitialized and print array object in C++

1 Answer

0 votes
#include <iostream>
#include <array>

using std::cout;
using std::endl;
using std::array;

template <typename T>
inline void print(const T &data)
{
	for (const auto &element : data) {
		cout << element << ' ';
	}
	cout << endl;
}

int main()
{
	array<int, 5> arr;

	print(arr);

	return 0;
}


/*
run:

-858993460 -858993460 -858993460 -858993460 -858993460

*/

 



answered Feb 1, 2018 by avibootz

Related questions

2 answers 230 views
2 answers 257 views
1 answer 107 views
1 answer 100 views
1 answer 147 views
...