Computer Science, asked by harikrish24, 5 months ago

in c programming language negative numbers when used in if else conditional checking,are treated as

(a) TRUE
(b) FALSE
(c) depends on the implementation
(d) None​

Answers

Answered by ayaanshpal840
14

Answer:

(a) TRUE

Hope it helps you

Click on the Thank You button and rate 5 stars also.

Thank You

Answered by guptaraj8120
4

Answer:

(a) TRUE

Explanation:

Negative values, and any non-zero values in general, are treated as true when used as conditions

#include <stdio.h>

int main(int argc, char** argv) {

   if (-1) {

       printf("-1 is true\n");

   } else {

       printf("-1 is false\n");

   }

   return 0;

}

Output:

$ g++ -Wall -pedantic test.c -o test-cpp

$ ./test-c

-1 is true

$ ./test-cpp

-1 is true

Similar questions