Showing posts with the label Assignment operator

Operators in C Language | Part-2

Assignment operator= operator is called assignment operator.It is used to move the value or expression result in a variable.Assignment operator are evaluated from right to left order.Example of assignment:a = b = 5, In this example the 5 is assignment in b then b's value is moved to a.a = b + 5, Assignment operator have the lowest precedence so all other operator are evaluated first and then result is moved to the variable.5 = a, This is an error, because in this example we are trying to move the value of variable into constant and constant can't be changed.The same error will be prompted if you are try the expression 6 + b = a.Compound assignment+=, -=, *=, /=, %= are called compound assignment operator. It combine the Arithmetic as well as assignment simultaneously.Compound AssignmentEquivalent Expressiona += 5a = a + 5a -= 5a = a - 5a *= 5a = a * 5a /= 5a = a / 5a %= 5a = a % 5PreviousBack to C Programming indexNext

Popular posts from this blog

Program to calculate telephone bill

Arrays in C Language

String in golang

Sum of two numbers in go lang

Pointers in C Language

Decision Making Statements

Say Hello world in Go lang

Decision Making in Go lang

Program to convert time from seconds to hours, minutes and seconds

Installing go lang