Accessing iterator

#include
#include

using namespace std;
int main() {
//cout<<“Hello World!”;
map<string,int> m;
m[“ram”]=30;
cout<<m[“ram”]<<endl;
m.insert(make_pair(“krishna”,79));
for(auto it=m.begin();it!=m.end();it++)
cout<first<<" "<second<<endl;

m.erase(“ram”);
auto it=m.find(“krishn”);
cout<<m[“a”];
// cout<<it==m.end();
cout<first<<endl;
for(auto x:m)
cout<<x.first<<" "<<x.second<<endl;

}
here in below iterator, we can access by . operator but in above iterator loop I have to use -> operator for accessing the element .is there any difference in both of them? or what is the reason use different operators

“->” is referred to as an arrow operator and is used to dereferencing a pointer, so the syntax is the same as (*ptr). Dereferencing a pointer means to get the value of that address, so for example:

struct Person{

string name;

int age;

};

Person *Bob = new Person;

Bob -> age = 21;