C Programming Language - Operator's Precedence and Associativity - Part 2

preview_player
Показать описание

This video session discuss about the Operator's Precedence and Associativity in C Programme. You can find a chart showing the Precedence and Associativity of various operators. We have solved few problems (taken from Exam papers)

Subscribe for more videos and latest updates.

regards,
Go-GATE-IIT
Рекомендации по теме
Комментарии
Автор

Hello Sir/Ma'am,
What you said in the video is if the first term in the AND operator is 1 and then let anything be for the second term it evaluates to true(1). It should instead be if the first term is 0 then anything (1 or 0) as second term when ANDed with that will produce a 0(false). When the first term for the logical OR is 1 then let whatever be the second term it evaluates to 1.
Kindly correct me if I am worng.

terigopula
Автор

@3.20 The explanation regarding && is quite contradictory.
If the 1st expression is true it checks for the 2nd expression
where as If the 1st expression is false it doesn't check 2nd expression.

VinayakLele
Автор

at 2:44 the logical and operator is mlre preferred so u need to check that first right but u checked the logical or operator sir

rohandevaki
Автор

Sir, In the first printf statement, why are the values of x, y, z not incremented before comparing them logically? My doubt is that as the pre-increment operator has higher priority than the logical operators, i thought that x, y, z will be incremented first before comparing them logically. Please tell me Sir.

chaitanyaj
Автор

sir can u please explain 2nd ans....
i solved the problem:
int i=3, j;
j=++i*++i*++i;
printf("%d%d", i, j);

i got (6, 150) but you said that it is(6, 216)

so, please sort out my doubt....

amanarts
Автор

&& The logical-AND operator produces the value 1 if both operands have nonzero values. If either operand is equal to 0, the result is 0. If the first operand of a logical-AND operation is equal to 0, the second operand is not evaluated.
quoted from microsoft web site but you explained otherwise.
Please clear my confusion.

neosmith
Автор

why are you evaluating operators with lesser precedence first ?? Say for instance ++x || ++y && ++z here ++ operator has max precedence among all present in this expression. So x, y and z must be incremented first and then && and finally ||.

MayankSharma
Автор

dear friends all the above answers are correct when i executed that above explanation as a code. the order of evaluation is according to the order in which the parse tree is constructed with respect to the operators && and || they are left associative so they are evaluated left to right .. the compiler first wont select the highest precedence operator and evaluate it first it constructs a parse tree and traverses it and evaluates while traversing it

saikumartadi
Автор

thanks for great tutorial. I could not get the answer to the second problem. i= 6 was calculated. j=120 was determined. can u solve it 4 me.

purushotamsangroula
Автор

Please go through the video once before posting it. Your flow is good, but you got confused with some facts.

subbagontla
Автор

1 anding with anything is true 3:22 😆😆

zahidfayaz
Автор

bhai ek bar khud dhang se samajh le fir dusro ko padhana
*ttime waste*

ishanbhatia