Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Operators and Expressions in C

Status
Not open for further replies.

HarshJain

Newbie
Newbie level 3
Joined
Jul 11, 2022
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
India
Visit site
Activity points
35
Hello Everyone, I am confused with the code can somebody tell me What is the output of the following program?

Code:
#include <stdio.h>
 
int main()
{
   int a = 1;
   int b = 1;
   int c = a || --b;
   int d = a-- && --b;
   printf("a = %d, b = %d, c = %d, d = %d", a, b, c, d);
   return 0;
}

Can someone help me with this?

Thanks in Advance!!
 

Use an online simulator :




Regards, Dana.
 
try this code and you will find the point:

int a = 1;
int b = 1;
printf("a = %d, b = %d \n",a,b);
int c = a || --b;
printf("a = %d, b = %d, c =%d \n",a,b,c);
int d = a-- && --b;
printf("a = %d, b = %d, c = %d, d = %d",a,b,c,d);
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top