Vector With Pinter Cout C

[Solved] Vector With Pinter Cout C | Vb - Code Explorer | yomemimo.com
Question : vector with pinter cout c++

Answered by : modern-manatee-uc9pul28y0bf

#include <iostream>
#include <vector>
using std::cout; using std::cin;
using std::endl; using std::string;
using std::vector;
template<typename T>
void printVectorElements(vector<T> *vec)
{ for (auto i = 0; i < vec->size(); ++i) { cout << vec->at(i) << "; "; } cout << endl;
}
int main() { vector<string> str_vec = {"bit", "nibble", "byte", "char", "int", "long", "long long", "float", "double", "long double"}; printVectorElements(&str_vec); return EXIT_SUCCESS;
}

Source : https://www.delftstack.com/howto/cpp/cpp-pointer-to-vector/ | Last Update : Fri, 14 Jan 22

Answers related to vector with pinter cout c

Code Explorer Popular Question For Vb