Chap. 1 : Unit 5 : Structure of C Language : Part 4

गेल्या १०-१२ वर्षाच्या शैक्षणिक कारकीर्दीमध्ये जितके ऑपरेटर पाहीले नसतील किंवा ऐकले नसतील त्यापेक्षा जास्त ऑपरेटरचे नमूने (माणसांप्रमाणेच) तुम्हाला या C programming language बघायला मिळतील/भेटतील/सापडतील किंवा आडवे येतीलlaugh. त्यांना वेगवेगळे अर्थ द्यायच डेनीस रिची च कौशल्य सुद्धा दिसेल… “मोठ्ठा माणूस” angel

We will study Ternary operator in the next chapter. Besides… in C, other than unary minus, ++, –, & are some of the examples of unary operators…. In mathematics, one can write expression like 3x + 4y equal to z…. but in C, its invalid statement. As per the rules stated by Dennis Ritchie, there should be variable on the left hand side and more importantly nothing is implicit while writing expression i.e. in mathematics 3x means 3 into x  but in C it gives an error and should be written as 3 into x! So above expression must be written as 3 into x plus 4 into y assigned to z in C I would like to reiterate one more important rule that, in C…. value of the expression on the right hand side or constant on the right hand side is assigned to variable on the left hand side. So though x is equal to x plus 3 is invalid statement in mathematics, it is valid in C. the reason is that here, 3 is first added to current value in the variable x and then the new value of expression is stored in… x itself. So if x contains 5 and expression is written as x is equal to x + 1 then 1 will be added to 5 and the new value i.e. 6 will be stored in x…. Hierarchy of Operators While solving an algebraic expression in school, you might have studied operator precedence rule. For example while solving the expression x is equal to 4 plus 5 into 7 divided by 9 minus 3 into bracket, you first solve the expression inside bracket then multiplication and division and addition in the last and then store the result in x…isn’t it? In C this is called as operator hierarchy. The chart of operator hierarchy is given here as in the standard book. Further we will solve a few small programs as well in the end of the chapter. Besides hierarchy, associativity also comes into picture when adjacent operators are having same precedence. For example in the above example multiplication and division operator have got same precedence. In such situation, expression needs to be solved from left to right. For few operators category like that of assignment operators, associativity is from right to left.

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. please register for Discount Coupon


Leave a Reply