Actually string::find()returns the position of the found string, but if it does not find the given string, it returns string::nposwhere it nposmeans without a position .
npos- This is an unsigned value, the standard defines it as a -1(signed presentation), which does not indicate a position.
cout << (signed int) string::npos <<endl;
Conclusion:
1
Take a look at Ideone: http://www.ideone.com/VRHUj
Nawaz source
share