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.

info about give program below

Status
Not open for further replies.

praveenkumar450

Newbie level 5
Joined
Jul 2, 2014
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Hyderabad, Andhra Pradesh, India
Activity points
55

Code C - [expand]
1
2
3
4
5
6
7
8
9
#include<stdio.h>
int main()
{
int a=6,b=8;
printf("%d\t",a=b);
printf("%d\t",a==b);
printf("%d  %d\n",a,b);
return 0;
}



and the output is
6 1 6 6
can i know why it 6 1 6 6
and for what it is executing like that
 
Last edited by a moderator:

the output should be
8 1 8 8
Code:
printf("%d\t",a=b);
assigns a the value of b, the result of the expression 8 is printed
Code:
printf("%d\t",a==b);
compares a with b and as both values are 8 the result is 1 (true)
Code:
printf("%d 	%d\n",a,b);
prints a and b both have the value 8
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top