answersLogoWhite

0


Best Answer

You use the dot operator when the left side is the name of the object or a reference to an object, and you use the arrow operator when the left side is a pointer to an object.

Example:

struct foobar x, *p= &x;

x.field = p->field;

(&x)->field = (*p).field;

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When to use the dot operator and when to use the arrow operator in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the memory management operator in c plus plus?

There is no memory management operator in C++ -- it is an unmanaged language. You use the C++ new operator to allocate memory, and use the C++ delete operator to release previously allocated memory.


What is the operator of power in c plus plus?

There is no "power" operator in C or C++. You need to the use the math library function pow().


Do you have to use delete operator on C plus plus strings before exiting your application?

no you dont


What is the use of bitwise operator in c plus plus?

They perform bitwise operations like AND (&), OR (|), XOR (^) and NOT (~).


Why are there 2 plus sign in c plus plus and Why not a single plus sign?

In C and in C++, the ++ operator means to increment. C++ was intended to be the next version, i.e. the incremental next step, of C, hence the use of the ++ operator.


How do you invoke method by using object of the class?

If you have and object with method described within its class you can use dot access operator, for instance:myObject.DoSomething();


What is use of dot in php?

The dot (.) operator in PHP is used to concatenate strings. For instance:$start = "Big";$end = "Bird";echo $start . ' ' . $end;This code would produce the output:Big Bird


What is use of dot operator in java?

"the dot" connects classes and objects to members. The places where you use it in what I cover are:(1) when you are connecting an object reference variable to a method. The Extending Existing Classes lesson introduces the dot operator for this use, and(2) when you are connecting a class name to one of its static fields. An example of this is the dot between "System" and "out" in the statements we use to print stuff to the console window. System is the name of a class included in every Java implementation. It has an object reference variable that points to a PrintStream object for the console. So, "System.out.println( "text") invokes the println() method of the System.out object.


How do i solve 5 plus the quantity 3 divided by five plus the quantity dot dot dot going on forever?

okay now that i can use punctuation. 5+3/(5+3/(5+3/(5+3/(..... is the problem. plz help me


Where do you find an arrow on the TI-84 plus silver edition?

The arrow keys are near the upper left corner of the keypad. If you want to type an arrow, use the store key. It looks like this: STO>.


Why use new and delete operator overloading in c plus plus?

one reason to use new and delete operator overloading in c++ is when you are using your own memory manager code. when the user of your code calls the new keywork, your memory manager code can allocate memory.


How what operator is most efficient you plus plus or plus plus you?

Efficiency is the same; the difference is when the "++" is evaluated, before or after other operations. For example: a = b++ // This will first copy b to a, then increment b. a = ++b // This will first increment b, then copy it to a. If you have the "++" operator by itself, it makes no different if you use prefix or postfix. a++ is the same as ++a.