0

help me,i want to print the number which i have assign 0 to 10 places;

#include<iostream> #include<vector> using namespace std; int main() { vector<int>*p=new vector<int>(10,0); cout<<p[0]; }

2nd Jun 2018, 12:18 PM
Bahubali
Bahubali - avatar
2 ответов
+ 25
Your vector is not a vector, it is a pointer to vector... so u need to do something like this 👇 cout << (*p)[0]; to print the elements...
2nd Jun 2018, 1:07 PM
🌛DT🌜
🌛DT🌜 - avatar
0
thanks :)
4th Jun 2018, 1:36 AM
Bahubali
Bahubali - avatar