There is actually a collection of operators that exist to make this a whole lot easier. The most important ones to know are =, =, -=, /=, *=, and %=.The syntax is a bit odd at first, but you will get used to it. The name for this operator sounds just like it looks. There are some others but they are very complicated compared to where we are right now, so we’ll ignore those for now.
It would be interesting to understand above program.
Above Program will always execute True Condition because Assignment Operator is used inside if statement not comparison operator.
Then we are adding y to x and assigning the result to x.
Finally we are printing the new value stored in variable x.
An assignment operator is the operator used to assign a new value to a variable, property, event or indexer element in C# programming language.
Assignment operators can also be used for logical operations such as bitwise logical operations or operations on integral operands and Boolean operands.pizzas To Eat %= 2 will give the remainder when divided by 2.These operators are great because once you are familiar with them they more clearly express what you are trying to do.Bitwise operators are used in C programming to perform bit-level operations.OUTPUTANALYSIS In this Assignment Operators in C program example, We declared 2 integer values a Total and we assigned values 7 and 21 respectively.Lets see what will happen in above example – Constant number 10 will be assigned to variable ‘value’.Variable ‘value’ will be treated as positive non-zero number, which is considered as true condition. they are members of the same union), the behavior is undefined unless the overlap is exact and the types are compatible.Although arrays are not assignable, an array wrapped in a struct is assignable to another object of the same (or compatible) struct type.Did you read the last blog on Increment and Decrement Operators? For example, we can have something like this: The left side of this will evaluate to 200 and then that will be assigned to pizzas To Eat. It’s a binary operator because it takes some value on the right and assigns to the variable on the left. In the previous blog I showed you how you can add one to a variable. I also showed you what to do if you wanted to add more than one to a variable.