as i am trying to clear the elements of vector its showing this error.how can i overcome this bug???
I hava created the vector as
vector ar[100001];
Error::::request for member ‘clear’ in ‘ar’, which is of non-class type ‘std::vector [100001]’
ar.clear();
Are you making array of vectors or simply a vector?
created vector as
vector ar[100001];
included
#include<bits/stdc++.h>
Array of vectors
Array does not support clear method. So you have to iterate over every element ar[i] and then apply clear method because it refers to a vector which does support clear method.
Use any loop and it will work.
1 Like