{"id":10515,"date":"2022-07-21T04:47:51","date_gmt":"2022-07-21T04:47:51","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=10515"},"modified":"2023-10-02T16:57:15","modified_gmt":"2023-10-02T11:27:15","slug":"logical-operators-in-c","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/","title":{"rendered":"Microcontroller Embedded C Programming Lecture 82| Logical operators in &#8216;C&#8217;"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<div class=\"boldgrid-shortcode\" data-imhwpb-draggable=\"true\">\n\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 32px; border-width: 0px; line-height: 45px;\"><span style=\"color: #000080;\"><strong>Logical operators in &#8216;C&#8217;<\/strong><\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; line-height: 45px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #8c033c;\"><strong>Logical operators in &#8216;C&#8217;<\/strong><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 30px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There are three types of logical operators.&nbsp;<\/span><\/p>\n<ol class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #ff0000;\"><strong>logical-AND (&amp;&amp;)&nbsp;<\/strong><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #ff0000;\"><strong>logical-OR (||)&nbsp;<\/strong><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #ff0000;\"><strong>logical-NOT (!)&nbsp;<\/strong><\/span><\/li>\n<\/ol>\n<figure id=\"attachment_10518\" aria-describedby=\"caption-attachment-10518\" style=\"width: 564px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-10518 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/07\/Figure-1-27-1024x144.png\" alt=\"Figure 1. Logical Operators in \u2018C\u2019\" width=\"564\" height=\"79\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-1024x144.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-300x42.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-768x108.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-600x84.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-1536x215.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-120x17.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-500x70.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-200x28.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-400x56.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-800x112.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27-1200x168.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-1-27.png 1868w\" sizes=\"(max-width: 564px) 100vw, 564px\" \/><figcaption id=\"caption-attachment-10518\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Logical Operators in \u2018C\u2019<\/span><\/figcaption><\/figure>\n<ul class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The logical operators perform logical-AND (&amp;&amp;), logical-OR (||), and logical-NOT (!) operations.<\/span><\/li>\n<li><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">These are binary operators except NOT (!) because it&#8217;s a unary operator.&nbsp;<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><strong><span style=\"text-decoration: underline;\">Truth Table<\/span><\/strong><\/span><\/p>\n<figure id=\"attachment_10520\" aria-describedby=\"caption-attachment-10520\" style=\"width: 586px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-10520\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/07\/Figure-3-19-1024x476.png\" alt=\"Logical operators in 'C'\" width=\"586\" height=\"272\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-1024x476.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-300x139.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-768x357.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-600x279.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-1536x714.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-120x56.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-500x232.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-200x93.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-400x186.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-800x372.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19-1200x558.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-3-19.png 1771w\" sizes=\"(max-width: 586px) 100vw, 586px\" \/><figcaption id=\"caption-attachment-10520\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Truth table<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; line-height: 45px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><strong><span style=\"text-decoration: underline; color: #000080;\">logical AND operator (<\/span> <\/strong><span style=\"color: #ff0000;\"><strong>&amp;&amp; <\/strong><\/span><\/span><strong>)<\/strong><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\"><span style=\"color: #ff0000;\"><strong>&amp;&amp;<\/strong><\/span> \u2192 this is the symbol or an operator to perform a logical-AND operation on the operands.<\/span><\/p>\n<ul class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The logical-AND operator produces the value 1 if both operands have nonzero values.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">If either operand is equal to 0, the result is 0. If the first operand of a logical-AND operation is equal to 0, the second operand is not evaluated.<\/span><\/li>\n<\/ul>\n<figure id=\"attachment_10519\" aria-describedby=\"caption-attachment-10519\" style=\"width: 589px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-10519\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/07\/Figure-2-23-1024x419.png\" alt=\"Logical operators in 'C'\" width=\"589\" height=\"241\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-1024x419.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-300x123.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-768x314.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-600x246.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-1536x629.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-120x49.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-500x205.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-200x82.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-400x164.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-800x328.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23-1200x491.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23.png 1920w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><figcaption id=\"caption-attachment-10519\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Example<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">For example, consider this expression <\/span><b>C = (A &amp;&amp; B<\/b><span style=\"font-weight: 400;\">). Here A=-10 and B=20. Here, A is nonzero and B is nonzero. Nonzero means true(1) in &#8216;C&#8217;. A is -10, so true and B is 20, so this operand is also true.<\/span><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">According to the truth table of the logical-AND, <\/span><b>A &amp;&amp; B<\/b><span style=\"font-weight: 400;\">, this expression will be evaluated.&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The truth table of AND, OR, and NOT is shown in Figure 2.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">If both operands are true, the result of the <\/span><b>AND<\/b><span style=\"font-weight: 400;\"> operation will be true. That&#8217;s why, A&amp;&amp;B this expression will be true. So, C = 1.&nbsp;<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<div class=\"mceTemp\"><\/div>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Now, A=0 and B=20. What is the result of <\/span><b>A&amp;&amp;B<\/b><span style=\"font-weight: 400;\">?<\/span><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">A is 0 means A is false. So, false. If one operand is false, you need not to check another operand. Because the result is anyway false, that&#8217;s why it will be straight away false. So, C will be 0.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now, A= 10, B=0, then what happens. A is true. So, if A is true, then only the B operand will be checked. In this case, it is 0, which means false. So, the result of the expression will be false.<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Remember that when you are using logical operators, you have to talk in terms of logical states like <\/span><b>true(1)<\/b><span style=\"font-weight: 400;\"> and <\/span><b>false(0)<\/b><span style=\"font-weight: 400;\"> of the variables or the expression. You should not consider the real value of the variables or the expressions.&nbsp;<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; line-height: 45px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><strong><span style=\"text-decoration: underline; color: #000080;\">logical OR Operator (<\/span> <\/strong><span style=\"color: #ff0000;\"><strong>|| <\/strong><\/span><\/span><strong>)<\/strong><\/p>\n<ul class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The logical-OR operator performs an inclusive-OR operation on its operands.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The result is 0 if both operands have 0 values according to the truth table.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">If either operand has a nonzero value, the result is 1.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">If the first operand of a logical-OR operation has a nonzero value, the second operand is not evaluated.<\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; line-height: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><strong><span style=\"text-decoration: underline; color: #000080;\">logical NOT operator (<\/span> <\/strong><span style=\"color: #ff0000;\"><strong>! <\/strong><\/span><\/span><strong>)<\/strong><\/p>\n<ul class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">It reverses the state of the operand.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">If a condition or expression is true, then Logical NOT operator will make it false.&nbsp;<\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For Example, A = 1, B = -5 and you have one expression like C = !(A == B). This is the combination of <a href=\"https:\/\/fastbitlab.com\/relational-operators-in-c\/\">relational operator<\/a> and logical operator. What is the value of C in this Expression?<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><b>C = !(A == B)&nbsp;&nbsp;&nbsp;&nbsp;<\/b><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><b>C= !(1 == -5)&nbsp;&nbsp;&nbsp;<\/b><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><b>C = !(0)<\/b><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><b>C = 1<\/b><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">First, the parenthesis will be evaluated. !(A == B), this is a relational operator. So, which is false. That&#8217;s why it will be 0. !(0), which is not of False. So, not of false is true. So, 1 will be stored here. C = 1.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now let&#8217;s take another example.<\/span><\/p>\n<figure id=\"attachment_10521\" aria-describedby=\"caption-attachment-10521\" style=\"width: 621px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10521 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/07\/Figure-4-17-1024x516.png\" alt=\"Figure 4. Example\" width=\"621\" height=\"313\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-1024x516.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-300x151.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-768x387.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-600x303.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-1536x774.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-120x61.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-500x252.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-540x272.png 540w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-200x101.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-400x202.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-800x403.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17-1200x605.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-4-17.png 1795w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><figcaption id=\"caption-attachment-10521\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Example<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Find out the x value in this x=!x expression? <\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here x=10.<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">x is a non-zero value, so the state of the x is true(1). Not of true means, which is false. So here !x is 0. So, 0 will be stored in x. Result is x = 0.<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s take another example. The expression is A = !((x&gt;5) &amp;&amp; (y&lt;5)); Here x=7, y=9. What is the value of A in the below expression?&nbsp;<\/span><\/p>\n<figure id=\"attachment_10522\" aria-describedby=\"caption-attachment-10522\" style=\"width: 643px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10522 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/07\/Figure-5-15-1024x635.png\" alt=\"Figure 5. Example\" width=\"643\" height=\"399\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-1024x635.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-300x186.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-768x476.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-600x372.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-1536x952.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-320x200.png 320w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-120x74.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-500x310.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-200x124.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-400x248.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-800x496.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15-1200x744.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-5-15.png 1832w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><figcaption id=\"caption-attachment-10522\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Example<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">First of all, parentheses will be evaluated first here. So, from left to right. x is greater than 5 (x&gt;5), which is <\/span><b>true(1)<\/b><span style=\"font-weight: 400;\">; this is a relational operator. y is less than 5 (y &lt; 5); it is false. That will be 0. So, A = !(1 &amp;&amp; 0).&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">A = !(1 &amp;&amp; 0) it is logical AND Operation. Truth(1) and False(0) is False(0), look at the Truth table(Figure 3). So the result will be false(0).&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Then, A= !(0). Not of 0 means 1. A will be 1 in this case.<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the following article, let&#8217;s understand the <a href=\"https:\/\/fastbitlab.com\/if-statement-in-c\/\">decision making in &#8216;C&#8217;<\/a>.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 18px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #993366;\"><strong>Get the Microcontroller Embedded C Programming Full Course on<\/strong> <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.udemy.com\/course\/microcontroller-embedded-c-programming\/\">Here<\/a>.<\/span><\/span><\/p>\n<p class=\"\" style=\"font-size: 20px; line-height: 31px; border-width: 0px;\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span>&nbsp;<\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Logical operators in &#8216;C&#8217; &nbsp; &nbsp; &nbsp; Logical operators in &#8216;C&#8217; There are three types of logical operators.&nbsp; logical-AND (&amp;&amp;)&nbsp; logical-OR (||)&nbsp; logical-NOT (!)&nbsp; The logical operators perform logical-AND (&amp;&amp;), logical-OR (||), and logical-NOT (!) operations. These are binary operators except NOT (!) because it&#8217;s a unary operator.&nbsp;&nbsp; &nbsp; Truth Table &nbsp; &nbsp; logical [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10519,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[16],"class_list":["post-10515","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-microcontroller-embedded-c-programming","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Logical operators in C with Example - AND(&amp;&amp;), OR(||), NOT(!)<\/title>\n<meta name=\"description\" content=\"Learn about the logical operators in C programming, including &amp;&amp; (logical AND), || (logical OR), and ! (logical NOT). How these operators\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Logical operators in C with Example - AND(&amp;&amp;), OR(||), NOT(!)\" \/>\n<meta property=\"og:description\" content=\"Learn about the logical operators in C programming, including &amp;&amp; (logical AND), || (logical OR), and ! (logical NOT). How these operators\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-21T04:47:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-02T11:27:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"786\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Microcontroller Embedded C Programming Lecture 82| Logical operators in &#8216;C&#8217;\",\"datePublished\":\"2022-07-21T04:47:51+00:00\",\"dateModified\":\"2023-10-02T11:27:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/\"},\"wordCount\":799,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/Figure-2-23.png\",\"keywords\":[\"Microcontroller Embedded C programming Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/\",\"name\":\"Logical operators in C with Example - AND(&&), OR(||), NOT(!)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/Figure-2-23.png\",\"datePublished\":\"2022-07-21T04:47:51+00:00\",\"dateModified\":\"2023-10-02T11:27:15+00:00\",\"description\":\"Learn about the logical operators in C programming, including && (logical AND), || (logical OR), and ! (logical NOT). How these operators\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/Figure-2-23.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/Figure-2-23.png\",\"width\":1920,\"height\":786,\"caption\":\"Figure 2. Example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/logical-operators-in-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microcontroller Embedded C Programming Lecture 82| Logical operators in &#8216;C&#8217;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Logical operators in C with Example - AND(&&), OR(||), NOT(!)","description":"Learn about the logical operators in C programming, including && (logical AND), || (logical OR), and ! (logical NOT). How these operators","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/","og_locale":"en_US","og_type":"article","og_title":"Logical operators in C with Example - AND(&&), OR(||), NOT(!)","og_description":"Learn about the logical operators in C programming, including && (logical AND), || (logical OR), and ! (logical NOT). How these operators","og_url":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-07-21T04:47:51+00:00","article_modified_time":"2023-10-02T11:27:15+00:00","og_image":[{"width":1920,"height":786,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Microcontroller Embedded C Programming Lecture 82| Logical operators in &#8216;C&#8217;","datePublished":"2022-07-21T04:47:51+00:00","dateModified":"2023-10-02T11:27:15+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/"},"wordCount":799,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23.png","keywords":["Microcontroller Embedded C programming Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/","url":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/","name":"Logical operators in C with Example - AND(&&), OR(||), NOT(!)","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23.png","datePublished":"2022-07-21T04:47:51+00:00","dateModified":"2023-10-02T11:27:15+00:00","description":"Learn about the logical operators in C programming, including && (logical AND), || (logical OR), and ! (logical NOT). How these operators","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/07\/Figure-2-23.png","width":1920,"height":786,"caption":"Figure 2. Example"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/logical-operators-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microcontroller Embedded C Programming Lecture 82| Logical operators in &#8216;C&#8217;"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/10515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=10515"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/10515\/revisions"}],"predecessor-version":[{"id":11064,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/10515\/revisions\/11064"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/10519"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=10515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=10515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=10515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}