Skip to main content

Operators

  • Chapter
  • First Online:
  • 4288 Accesses

Abstract

The assignment operator = assigns a value to a variable / object:

int main() {     char mychar = 'c';    // define a char variable mychar     mychar = 'd';         // assign a new value to mychar     int x = 123;          // define an integer variable x     x = 456;              // assign a new value to x     int y = 789;          // define a new integer variable y     y = x;                // assing a value of x to it }

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Slobodan Dmitrović

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Dmitrović, S. (2020). Operators. In: Modern C++ for Absolute Beginners. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-6047-0_7

Download citation

Publish with us

Policies and ethics