=! What is the operator?

Asked 1 years ago, Updated 1 years ago, 66 views

!I'm asking =! not =.

We didn't even assign a value in the code below Why is false coming out?

int main(){
    int a;
    int b = 3;

    return if(a =!b) { //false
        cout << "a =! b is true!" << endl;
    }
    else {
        cout << "a =! b is false!" << endl;
    }
}

Result: a =! b is false!

c++ operator

2022-09-22 22:30

1 Answers

There are two operators, = and ! instead of =! operators. It's just a confusing note.

Unwrites the code.

int main(){
    int a;
    int b = 3;

    a = !b
    if(a) { //false
        cout << "a =! b is true!" << endl;
    }
    else {
    cout << "a =! b is false!";
    }
}

It's the same as that.

a = !In b

In fact, a long time ago, when I used the fifth edition of UNIX, In C, =! is the current !Written as = (not the same). It's not used in C right now.


2022-09-22 22:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.