I'm having an issue in one of my functions. I'm trying to format my if statement using the ? and : because I thinks it looks nicer and makes things more readable. But I keep getting an error.
This is the code:
I want it to look like this:Code:if(m_search != m_first->prev) m_search = m_search->next; else return;
However I get the following error.Code:(m_search != m_first->prev) ? m_search = m_search->next : return;
1>c:...\projects\program1\linklist.h(155): error C2059: syntax error : 'return'
Are you not allowed to return when using that format? Or am I just writing it wrong?
Oh, and it's a void function by the way.




Reply With Quote