What is the difference between ptr and rptr?
If you do char *world = "World"; rptr = world;
and then print str
, it will print “World”. If you do ptr = world;
and then print str
, it will print “Hello”.
More Related Contents:
- What are the differences between a pointer variable and a reference variable in C++?
- When to use references vs. pointers
- When should I use the new keyword in C++?
- Pointer vs. Reference
- Reason to Pass a Pointer by Reference in C++?
- C++ pass an array by reference
- Why are references not reseatable in C++
- C++ standard: dereferencing NULL pointer to get a reference? [duplicate]
- Why is ‘this’ a pointer and not a reference?
- difference between a pointer and reference parameter?
- how does the ampersand(&) sign work in c++? [duplicate]
- What are the differences between a pointer variable and a reference variable?
- Passing references to pointers in C++
- Difference between pointer to a reference and reference to a pointer
- What’s the meaning of * and & when applied to variable names?
- error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’
- What is the difference between std::reference_wrapper and a simple pointer?
- Why can’t I do polymorphism with normal variables?
- Why doesn’t reference-to-member exist in C++?
- Confusion about pointers and references in C++
- Returning non-const reference from a const member function
- C++: difference between ampersand “&” and asterisk “*” in function/method declaration?
- dereferencing a pointer when passing by reference
- Use const wherever possible in C++?
- Where ampersand “&” can be put when passing argument by reference?
- Why isn’t operator overloading for pointers allowed to work?
- C++ strings: [] vs. *
- What is the proper way to return an object from a C++ function?
- Meaning of *& and **& in C++
- Both asterisk and ampersand in a parameter