title: Can I use bool data type as below?in C language
body: <pre><code>#include &lt;stdio.h&gt;  
  #include&lt;stdbool.h&gt;  
  int main()  
  {
      bool x;
      bool y;
      printf(&quot;Please enter two numbers, each of which can be 0 or non-0: &quot;);
      scanf(&quot;%d %d&quot;, &amp;x, &amp;y);
      printf(&quot;The value of x&amp;&amp;y is %d&quot;, x&amp;&amp;y);  
      printf(&quot;\nThe value of x||y is %d&quot;, x||y);  
      printf(&quot;\nThe value of !x is %d&quot;, !x);  
      printf(&quot;\nThe value of !x is %d&quot;, y^x);  
  }
  </code></pre>
  <p>Why the output is coming like this? (wrongly)</p>
  <pre><code>Please enter two numbers, each of which can be 0 or non-0: 1 0
  The value of x&amp;&amp;y is 0
  The value of x||y is 0
  The value of !x is 1
  The value of !x is 0
  </code></pre>
  <p>According to boolean algebra these should be:</p>
  <pre><code>The value of x&amp;&amp;y is 0 ,
  The value of x||y is 1 ,
  The value of !x is 1 ,
  The value of !x is 1 
  </code></pre>