I’m studying for exams and I have a doubt with the ! operator. It always returns 1 if it’s applied to 0 and returns 0 otherwise, even if the value is negative or something?
Conversation
Notices
-
Suguivy :knights: (suguivy@awoo.fai.su)'s status on Saturday, 08-May-2021 13:05:20 CEST Suguivy :knights: -
Suguivy :knights: (suguivy@awoo.fai.su)'s status on Saturday, 08-May-2021 14:33:47 CEST Suguivy :knights: @kogomi oh, but is not supposed that C++ can compile any C code and be compatible?
-
Rina (🌺◡ ‿ ◡) (kogomi@raru.re)'s status on Saturday, 08-May-2021 14:33:47 CEST Rina (🌺◡ ‿ ◡) @Suguivy no, c and c++ have different internal behaviour lile c++ working with boolean types
-
Rina (🌺◡ ‿ ◡) (kogomi@raru.re)'s status on Saturday, 08-May-2021 14:33:48 CEST Rina (🌺◡ ‿ ◡) @Suguivy 0 returns 1, 1 and nonzero returns 0
-
Rina (🌺◡ ‿ ◡) (kogomi@raru.re)'s status on Saturday, 08-May-2021 14:33:48 CEST Rina (🌺◡ ‿ ◡) @Suguivy please note this is not true* in c++
-
Suguivy :knights: (suguivy@awoo.fai.su)'s status on Saturday, 08-May-2021 14:36:42 CEST Suguivy :knights: I already know the operator but I mentioned to use it specifically with other numbers rather than 1 or 0 because I’m doing some exercises that include weird uses of ! and I should know what it returns
-