Programming Question

Mikealot

Member
Nov 15, 2003
44
0
0
Guys, could someone tell me what the C++ String member function "find" returns if it does not find the item being searched?
 

Templeton

Senior member
Oct 9, 1999
467
0
0
It will return the static constant string::npos (which is the largest possible value of size_type, or -1)
It's a matter of style, but I'm on the side of comparing to this constant rather then -1 directly.