Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

c++ syntax

vtuneuser
Beginner
490 Views

Can someone explain what does the following c++ statement mean?

(h=h)->heapindex=j;

Is this the combination of two assignments?

Thanks.

0 Kudos
2 Replies
simonr
Beginner
490 Views
Is equivalent to:
h=h;
h->heapindex=j;


The parentheses ensure that the 1st asignment occurs before the '->' operator, which operates on the return value from this 1st assignment: h (as in 'a=b=c'). The array 'h' ends up with two references to the same element (originally h) after this operation.

Simon
0 Kudos
vtuneuser
Beginner
490 Views
thank you.
0 Kudos
Reply