How can I see if the element I'm looking for is present in my array?
I would carry out the following in Java:
Foo someObject = new Foo(someParameter);
Foo foo;
//search through Foo[] arr
for(int i = 0; i < arr.length; i++){
if arr[i].equals(someObject)
foo = arr[i];
}
if (foo == null)
System.out.println("Not found!");
else
System.out.println("Found!");
What would be the C++ solution, though, since I don't believe I'm allowed to search if an Object is null in C++?