Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

the compiler reports to me “Value computed is not used”. What is wrong here?

compiler reports wrong
0
Posted

the compiler reports to me “Value computed is not used”. What is wrong here?

0

Note that although operators ‘++’ and ‘*’ have the same precedence, ‘++’ will be evaluated first, so this expression will be evaluated as *(ptr_to_a++); i.e. it increases the pointer, then reads the value from it (which is not used for anything). This is not what do you want, of course. To perform what do you want (i.e. to increase the variable pointed to by the pointer), use parentheses to change the order of evaluation, i.e. use (*ptr_to_a)++; This will work as expected.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123