for(auto p: factors). I didn’t understand the significance of this type of for loop
Sir what is the meaning of this code line
hello @aryaman.kumar26
that is for each loop. it just makes our code syntax small and readable.
read more about them from here -> https://www.geeksforgeeks.org/range-based-loop-c/
std::vector< int > v = {0, 1, 2, 3, 4, 5};
for ( auto i : v)
std::cout << i << ' ' ;
sir then it means we declare a variable i which runs for each item of vector… right?
and sir when I am doing by-
for(int i=vector.start();i<=vector.end();i++)
this is showing error. why?
vector.start return an iterator (it is different than int datatype more like a pointer )
so either use vetcor::iterator i or auto i