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

Jun 30, 2015 at 10:55am
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?
Jun 30, 2015 at 11:02am
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.