Suppose I have two different structures, Struct1 and Struct2. They both have different elements in them.
What happens if I compare them like this:
if((Struct1) && (Struct2))
{
doSomething();
}
I just found some code with this logic and was wondering what was happening.
Thanks!
EDIT: Struct1 and Struct2 are both pointers to two different structures, not structures themselves.
For that to work, you must have pointers, not structures. That is, the code might be:
This checks that neither of the pointers is NULL before using them. You cannot compare structures directly, so if the code were:
you would have a semantic error; you simply cannot compare whole structures with anything.
The capitalization of the variables is aconventional.