I feel really stupid for asking this question but…
What are the uses of “!” in c++?
I feel really stupid for asking this question but…
What are the uses of “!” in c++?
It means "not".
One usage is to check if something is false. It reverses a boolean true to false and false to true.
For example, instead of doing this:
You can do this:Code:if(somevar == false) { }
Code:if(!somevar) { }