Question: Q1: Write a C program that demonstrates C's short-circuit evaluation of the && and || operators. Include two user-defined functions, fun1 and fun2. Function fun1
Q1: Write a C program that demonstrates C's short-circuit evaluation of the && and || operators. Include two user-defined functions, fun1 and fun2. Function fun1 prompts the user to enter "T" for true or "F" for false. If the user input is "T," fun1 returns 1; otherwise it returns 0. Function fun2 simply displays "fun2 executed" and then returns 1. Function main should include two conditional statements: one that displays "Test of && complete" if the && of function calls to fun1 and fun2 is true. The second conditional statement displays "Test of || complete" if the || of function calls to fun1 and fun2 is true. Before the first conditional statement, display "Testing &&," and before the second, "Testing ||." Then test your program four times with inputs of T T, T F, F T,and FF.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
