Skip to content Skip to sidebar Skip to footer

Assignment Operator in C++

Let me assign you a task to learn something more and get closer to your goal of learning c++ as much as possible. For this task, the topic would be Assignment operators. The assignment itself means giving a task to someone. So let’s start with the Assignment Operators and win it over.

What is an Assignment Operator?

An assignment operator is nothing but a way through which we can provide a value or assign a value to a variable. And the way we symbolize it is by using an equal to( = ) sign. The variable on the left side of this operator stores the value given on the right side of the assignment operator.

Types of Assignment operators.

We have about 11 different assignment operators to help us:

Assuming the value of variable a is 10.

OperatorsExampleSame asOutput
=a=10a=10 10
+=a+=2a=a+212
-=a-=2a=a-210
*=a*=2a=a*220
/=a/=2a=a/25
%=a%=2a=a%20
(returns remainder)
&=a&=2a=a&22
|=a|=2a=a|210
^=a^=2a=a^28
>>=a>>=2a=a>>22
<<=a<<=2a=a<<240

CONCLUSION

In this blog, we’ve learned about another category of Operators known as Assignment Operators and have taken another step in our journey of learning  C++ programming. We got to know what they exactly are and how they make assigning a value to a variable easy—hoping to learn many more related topics shortly.

As you all know, GeekonPeak has just begun and is looking for some loyal supporters so we, the new-gen geeky friends, can grow and create more comprehensive and easy-to-grasp courses for you (for free). Follow us on FacebookInstagram & Twitter as well. Also, don’t miss our newsletter subscription. We provide exclusive blogs, tips, tricks, and advice to program efficiently and market smartly. We also promote some of our partners with excellent experiences to share with you. Until next time 🙂 

2 Comments

  • Rohan Ahuja
    Posted June 12, 2023 at 11:49 AM

    hello this is an amazing blog

    • Kritish
      Posted June 12, 2023 at 1:26 PM

      Thank You, Rohan!

      Geeky Audience is almost ready to see you in our latest Java Blogs.

      I hope you’re ready to lead the upcoming Java Beginners Series 🙂

Leave a comment

Sign Up to Our Newsletter

Be the first to know the latest updates