Answer the question
In order to leave comments, you need to log in
How to write a function that may not return a value?
For example, there is a search function that looks for an object in an array and returns the first one found, but what should it return if it does not find anything?
Object& find (Object o)
{
/* Поиск, если нашли */
return link;
/* Если не нашли? */
return NULL; // - Нельзя
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question