cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
what does ! mean when its before anythin
what does ! mean when its before anything?
Mar 14, 2016 at 6:29am UTC
Raakfal
(17)
I came across a code while studying and was confused by the ! due to where it was placed can anyone help me our on this?
1
2
3
4
if
(S.empty() || !ArePair(S.top(),exp[i]))
return
false
;
else
S.pop();
notice the ! before the ArePair my assumption is that if it returns false then the "return false" would be activated right?
Mar 14, 2016 at 7:06am UTC
Peter87
(11238)
! is the logical NOT operator. It turns false into true and true into false.
If
ArePair(a, b)
checks if
a
and
b
is a pair, then
!ArePair(a, b)
will check if
a
and
b
is
not
a pair.
Mar 15, 2016 at 2:04am UTC
Raakfal
(17)
Thank you :)
Topic archived. No new replies allowed.