Difference between string::size_type len and...

I have been reading my book for quite a while and also at the same time seeing several forum members using these string::size_type lenThis one was in my book; however, I have not fully been able to understand the purpose of this.In my book I have a code

1
2
3
string::size_type len;
len=name.length()
cout<<len;


1.) Why can't we just use int length since all this would return is some numerical value? (I'm sure im wrong in this though :D )
Last edited on
Here's a nice explanation:
http://stackoverflow.com/questions/1181079/stringsize-type-instead-of-int

I normally just use size_t...that's actually the first time I've ever seen string::size_type. (Not sure if that's a bad thing or not)
lol, I read that like 15 minutes ago :D definitely a good explanation :) and thank you for your answer :)
Topic archived. No new replies allowed.