for the find stl function is this the fixed syntax
auto it=find()
what i mean is that is it compulsory to use auto and it?
also can i get some sources to learn more on this??
for the find stl function is this the fixed syntax
auto it=find()
what i mean is that is it compulsory to use auto and it?
also can i get some sources to learn more on this??
hello @ashishxmathew
no not compulsory but its easy .
example->
if we use find on vector then return iterator right? so if u dont write auto then we need to write somthing like
vector::iterator it = find()
oh so this " it " is not a variable it is something else?? it stands for iterator?
so when we are using find we have to use “it” alongside with it right?
it is like variable name and its datatype is iterator .
u can think it like a pointer.
also the name it is not fixed , u can give any name.
for example
int x=something; // here x is variable name and int is its type
similary
vector<int>::iterator it=find() ; // here it is variable name and vector<int>::iterator is its datatype
oh so even if we use something like say
auto x=find( );
here x is the variable and auto will recognize that it is an iterator datatype
it will still work right?? and thanks by the way.
yeah auto will detect datatype on its own