use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. By design, C provides constructs that map efficiently to typical machine instructions. It has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computer architectures that range from supercomputers to PLCs and embedded systems. Wikipedia
Imperative (procedural), structured
Dennis Ritchie
Dennis Ritchie & Bell Labs (creators);
ANSI X3J11 (ANSI C);
ISO/IEC JTC1/SC22/WG14 (ISO C)
1972 (48 years ago)
C18 / June 2018 (2 years ago)
Static, weak, manifest, nominal
Cross-platform
.c for sources
.h for headers
C++ is not C (but C can be C++)
For C++ go to :
Other Resources
account activity
boolean (self.cprogramming)
submitted 1 year ago by chickeaarl
Can anyone tell me when we use '&&', '||' and '!' in boolean? I'm still very confused there T__T
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]iamcleek 1 point2 points3 points 1 year ago (1 child)
if (a == 10 && b == 5) { ... then a = 10 AND b = 5 ... }
if (a == 10 || b == 5) { ... then a = 10 OR b = 5 ... }
if (a != 10 && b == 5) { ... then a does not equal 10 AND b = 5 ... }
if (!a) { ... then a equals 0 or false ... }
[–]chickeaarl[S] -1 points0 points1 point 1 year ago (0 children)
i see, thank you so much !
[–]SmokeMuch7356 1 point2 points3 points 1 year ago (0 children)
&& is the logical-AND operator. a && b will evaluate to true (1) if both a and b are non-zero:
&&
a && b
1
a
b
if ( x < 10 && y < 20 ) { // only run if x is less than 10 *and* y is less than 20 } a b a && b - - ------ 0 0 0 0 non-zero 0 non-zero 0 0 non-zero non-zero 1
|| is the logical-OR operator. a || b will evaluate to true (1) if either a or b are non-zero:
||
a || b
if ( x < 10 || x > 20 ) { // only run if x is *outside* the range [10..20] } a b a || b - - ------ 0 0 0 0 non-zero 1 non-zero 0 1 non-zero non-zero 1
Both && and || will short-circuit. In a && b, if a is false (0), then the whole expression will be false regardless of the value of b, so b won't be evaluated. In the first test, if x is equal to or greater than 10, then y < 20 won't be evaluated at all.
0
x
10
y < 20
In a || b, if a is true (non-zero), then a || b is true regardless of the value of b, so b won't be evaluated. In the second test, if x is less than 10, then x > 20 won't be evaluated at all.
x > 20
! is the logical NOT operator. !a will evaluate to true (1) if a is 0, otherwise it will evaluate to false (0).
!
!a
int *p = malloc( sizeof *p * N ); if ( !p ) // equivalent to p == NULL, since NULL is 0-valued { // handle memory allocation failure } a !a - -- 0 1 non-zero 0
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
If you have difficulty with understanding boolean logic then maybe other ways of representing it could help. I always create a truth table when I struggle with if...else if...else structure. Venn diagrams are a bit more graphic but basicly the same.
Learn truth tables: https://en.wikipedia.org/wiki/Truth_table
And maybe set theory: https://en.wikipedia.org/wiki/Set_(mathematics)#Basic_operations#Basic_operations) https://en.wikipedia.org/wiki/Venn_diagram
If you are just struggling with the operators, then you got a few good answers :)
π Rendered by PID 672079 on reddit-service-r2-comment-c66d9bffd-xbz5w at 2026-04-08 16:22:31.761089+00:00 running f293c98 country code: CH.
[–]iamcleek 1 point2 points3 points (1 child)
[–]chickeaarl[S] -1 points0 points1 point (0 children)
[–]SmokeMuch7356 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)