Can print the values of iterators using printf() but not cout<<

1
2
3
4
5
6
7
8

string s ="nabil" ;
cout<<s.begin()<<nln; //gives me error

//but this prints some values
printf("%d  %d",s.begin(),s.end());


Didn't get why?
Both are wrong. With cout you have the advantage the the compiler is able to check for correctness while in the printf case it can't check.
Topic archived. No new replies allowed.