while ( current->next != NULL){ current = current -> next; }
current -> next = new; new -> next = NULL; new -> val = val; }
Cooper Nguyen
!= is a comparison operator, while =! sets a variable to the NOT of the right side
fag != NULL is different to fag = !NULL
Ryan Edwards
so it sets it to any random variable that is different from the left side?
Jose Morgan
this it's not =! null but = !null
Jonathan Anderson
It sets it to the NOT of the right side variable, NOT is an operation like AND/OR/XOR/etc, basically just flips the bits of the variable
So if you had fag =! 0, that would set fag to the NOT of 0 which should be 0xFFFFFFFF, and vice versa I suppose
Brandon King
No, it sets it to !NULL. Which is 1. Which is not a sensible pointer value, and breaks when you try to dereference it.
Jeremiah Ward
it sets it to 1 if right side is equal to 0 and to 0 if right side > 0
Jonathan Hall
Hahaha, you're fucking dumb.
Luke Lewis
No, that's the ~ operator, not the ! operator. The ! operator maps 0 to 1 and anything else to 0. So !NULL is 1, not 0xffffffff or anything like that.
Joseph Russell
s/>/!=
Samuel White
i += 1;
is different from
i = +1;
Juan Sanders
Oh yeah your right, knew I had something wrong after posting that
But yeah anyway OP, IIRC there's no actual valid comparison operators that start with =, other than "==" ofc (the rest are = != etc) So if you ever see an if statement that has an operator starting with "=" it's safe to say that the statement is setting the variable instead of comparing it, which some compilers will warn about but not all
James Martin
ok I got it . thanks.
x =! NULL = 1
Xavier Moore
Yes but to be pedantic (!NULL == 1) == true x = !NULL (x == 1) == true
Alexander Cook
!= 5 means "NOT equal to 5" =! 5 means "equal to NOT 5"; it is equivalent to = !5
Luis Young
What the fuck is !5? Wouldn't that give an error?
Jonathan Murphy
Logical unary NOT returns 1 if given a non-zero operand, and 0 otherwise. That's all.
Levi Lee
Oops. Other way around.
It's late.
Parker Johnson
Any primitive type in C can be treated as a boolean. That includes integers and pointers. The bool type didn't get introduced until C99.
Nathaniel Ramirez
>18 years later and we still use 28 years old language Seems like fine.
Chase Ortiz
Just because something is old does not automatically make it bad.
Isaac James
Can you stupid cturds please stop re-implementing the fucking linked list over and over again? Not only is it a problem that has been solved millions of times already, the linked list as a data structure sucks ass.
I'm starting to wonder if linked lists are the only thing the average Sup Forums c programmer can program.
Daniel Scott
And every time niggers are reimplementing and reimplementing Booleans just because they don't use modern languages.