Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Help 

Boolean operators in C

i do not understand them in the slightest

Code
A. !( 1 || 0 )         ANSWER: 0    
B. !( 1 || 1 && 0 )    ANSWER: 0 (AND is evaluated before OR)
C. !( ( 1 || 0 ) && 0 )  ANSWER: 1 (Parenthesis are useful)

ill start with A, i read it as "not or 1 or 0 so it must equal 0" like how in the fuck does that work?!

i dont understand "!" either; if true: false, if false: true. like what the hell??? why???
It's the order of operations you aren't seeing or apparently following. Just like in normal math, C also has order of operations.
https://en.cppreference.com/w/c/language...dence.html

1a. 1 or 0 results in 1
1b. Not 1 results in 0

2a. 1 and 0 results in 0.
2b. 1 or 0 results in 1
2c. Not 1 results in 0

3a. 1 or 0 results in 1
3b. 1 and 0 results in 0
3c. Not 0 results in 1
(Aug 27, 2025 03:13 PM)webdev77 Wrote:  It's the order of operations you aren't seeing or apparently following. Just like in normal math, C also has order of operations.
https://en.cppreference.com/w/c/language...dence.html

1a. 1 or 0 results in 1
1b. Not 1 results in 0

2a. 1 and 0 results in 0.
2b. 1 or 0 results in 1
2c. Not 1 results in 0

3a. 1 or 0 results in 1
3b. 1 and 0 results in 0
3c. Not 0 results in 1

oh my god i get it now! haha!

the order of operations is what i didnt know existed, thank you dude

i hate being slow tho, like i can feel my slowness - its aggravating
(Aug 27, 2025 03:49 PM)schassis Wrote:  oh my god i get it now! haha!

the order of operations is what i didnt know existed, thank you dude

i hate being slow tho, like i can feel my slowness - its aggravating

You're very much welcome. Keep at it and you'll be building fun stuff in no time.

Here's a freely available hex dump function that'll help you when you play around with strings and any buffers containing non-printable characters. I don't know if you have covered strings and buffers in C yet but you likely will soon if you haven't yet.

Function (Click to View)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Help] by KalvaxasJun 12, 2023 07:08 PM 5 343 Jun 12, 2023 07:08 PM
Last Post: Kalvaxas
by James BurnhamAug 2, 2020 04:47 PM 0 84 Aug 2, 2020 04:47 PM
Last Post: James Burnham
by UglehFeb 26, 2016 07:00 PM 4 150 Feb 26, 2016 07:00 PM
Last Post: Ozedath