+ 3

Help is "=! " the same as " != " ??

#include<stdio.h> #include<stdlib.h> int main(){ int a=1; a=(a=!1); a=(a!=1); printf("%d",a); return 0; } // output: 1 intead of 0

24th Feb 2022, 2:07 PM
Mik
Mik - avatar
4 Antworten
+ 7
"!=" is "not equal" but "=!" is "assignment" and "not" So a = (!1) would be 0 Your example gives me a warning for the line after int a=1
24th Feb 2022, 2:32 PM
Lisa
Lisa - avatar
+ 5
Mik_RDC a =!1 means a = !1 = 0 a != 1 means a is not equal to 1 don't think =! is a syntax, actually it is a = !1
24th Feb 2022, 2:31 PM
A͢J
A͢J - avatar
+ 2
1) "=!" - you may gorget for a second about "=", becouse "!" will invert only 1 !!! thing after it (0 to 1 and 1 to 0). And only after inverting you can make an assignment with "=" 2) "!=" also inverts, but the result, result of two things (variables, numbers, chars ...)
24th Feb 2022, 8:24 PM
Pavel 10 🇷🇺
Pavel 10 🇷🇺 - avatar
+ 1
I don't think so... `!=` and `!==` means "not equal to..." and "strictly not equal to". And I don't think that's even a syntax of a code...?
25th Feb 2022, 6:27 PM
Chi Zu
Chi Zu - avatar