+ 9

What is the difference between ** and * operator??

*ptr ,**ptr

6th Jan 2018, 12:28 PM
Subha
Subha - avatar
9 Antworten
+ 13
*ptr is pointer and **ptr is pointer to pointer. So pointer to pointer **ptr will have three asterix ***ptr, pointer to that pointer four and so on...
6th Jan 2018, 12:34 PM
Vukan
Vukan - avatar
+ 4
@Ace That's true. Thank you for telling me!
7th Jan 2018, 6:03 AM
Naveen Maurya
Naveen Maurya - avatar
+ 4
7th Jan 2018, 6:29 AM
Naveen Maurya
Naveen Maurya - avatar
+ 3
* means multiplication and ** means to the power. example- 2**3=8(2*2*2)
7th Jan 2018, 4:55 AM
Suman Basak
Suman Basak - avatar
+ 3
@Suman Actually, the question is asking about these operators in pointers and not in arithmetical expressions. One more thing is that in C++ we do not use ** as exponent operator. Instead, ^ is used. 5^3 means 125!
7th Jan 2018, 5:49 AM
Naveen Maurya
Naveen Maurya - avatar
+ 2
In fact ** is not an pointing operator. It is used to point to another pointer. For example, string object = "Some text!"; string *ptr = &object; string **ptr =& ptr; // Here **ptr is actually *(*ptr)! cout << *ptr; // Output: Some text! // You may point to other pointers by adding an //asterisk in front. // A pointer to the pointer to the pointer will be ***ptr and so on!
6th Jan 2018, 1:58 PM
Naveen Maurya
Naveen Maurya - avatar
+ 1
** means raise to some power. * means the ordinary multiplication.
15th Nov 2018, 4:04 PM
Irha Sheikh
Irha Sheikh - avatar
- 1
** for like a=2 and b=3 then use puts a**b o/p is 8
7th Jan 2018, 11:41 AM
techking learn
techking learn - avatar
- 1
honestly have no clue
10th Jan 2018, 12:13 AM
Jacob Jones
Jacob Jones - avatar