tags:

views:

210

answers:

3

Can you tell me the meaning of a**=b; in C. Also please define the ** operator;

+16  A: 

There is no such operator (**=) in C. It results in syntax error.


There "is" ** in C though, which is always tokenized as * followed by a *, e.g.

int a;
int* b;
int** d;

int c = a**b;  // c = (a) * (*b)
int e =** d;   // e = *(*d)  

Your code a**=b is tokenized as a * *= b, which is syntax error.

KennyTM
What the heck is a *b?
Azz
@Azz: `b` is a pointer to an int, and the unary `*` *dereferences* the pointer to give back an `int`. See http://en.wikipedia.org/wiki/Pointer_(computing)#C_pointers
KennyTM
@Azz: if be is a pointer, then `*b` is the value pointed by the pointer; this is called dereferencing.
Cedric H.
Thanks mate, I've never touched C but it just intrigued me.
Azz
@azz: (Off topic) [C# has this too (with the same syntax)](http://msdn.microsoft.com/en-us/library/tcy5wf0h.aspx), but that is unsafe code. :)
KennyTM
+2  A: 

That type ( **) operator not aviable in c . If you use then it will give compile time error.

Anand Kumar
Wrong... that's two pointer dereference operators as stated in another answer.
alxx
+1  A: 

Yes, there is no **= operator in C. In C ** is used for pointer to a pointer.

example: int **a refers to a pointer to an integer pointer. here a stores address of an integer pointer.

Anji
I meant there is no `**=`.
Anji
Then edit your answer
kigurai