How this program will accept and print all type of datatype

instead of writing vector inside print() function when i write vector it works.How to make this generalise

typename vector ::iterator it;
You need to write typename before creating an iterator whose datatype is unknown,
Or
no need to create “it” before, directly inside for loop write
auto it=v.begin();
auto will take care of datatype.