Try the fastest way to create flashcards
Question

What does the indirection operator do?

Solutions

Verified
Answered two weeks ago
Step 1
1 of 2

A pointer is a variable which holds the address of another variable, so all operations like addition, subtraction, ... etc, deal with the address value, not the item pointed by the pointer.
And if you want to deal with the item itself, C++ defines an operator called indirection operator, which is an asterisk [ * ] before the pointer, that dereferences the pointer enabling dealing with the item. for example,

    int x=5,*ptr = &x;
    cout<<ptr;  // prints the address of the pointer
    cout<<*ptr; // prints the value pointed by the pointer [5]

Create a free account to view solutions

Create a free account to view solutions

Recommended textbook solutions

Computer Organization and Design MIPS Edition: The Hardware/Software Interface 5th Edition by David A. Patterson, John L. Hennessy

Computer Organization and Design MIPS Edition: The Hardware/Software Interface

5th EditionISBN: 9780124077263 (6 more)David A. Patterson, John L. Hennessy
226 solutions
Starting Out with C++: Early Objects 8th Edition by Godfrey Muganda, Judy Walters, Tony Gaddis

Starting Out with C++: Early Objects

8th EditionISBN: 9780133360929Godfrey Muganda, Judy Walters, Tony Gaddis
844 solutions
Fundamentals of Database Systems 7th Edition by Ramez Elmasri, Shamkant B. Navathe

Fundamentals of Database Systems

7th EditionISBN: 9780133970777Ramez Elmasri, Shamkant B. Navathe
948 solutions
Introduction to Algorithms 3rd Edition by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen

Introduction to Algorithms

3rd EditionISBN: 9780262033848 (3 more)Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
872 solutions

More related questions

1/4

1/7