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.

When I try to turn the calculator off using off function from system.h, nothing happens. What is wrong?

0
Posted

When I try to turn the calculator off using off function from system.h, nothing happens. What is wrong?

0

Most probably, you wrote off; instead of off (); This is very common misinterpretation of usage of argument-less function. You may ask why the compiler did not display any errors? See, whenever you use the function name alone (without the parenthesis), it is automatically converted to a pointer to the function (this is very useful feature if used properly). So, ‘off’ alone is interpreted as a pointer, so you have an statement which consists of an effect-less expression, similarly as if you wrote 2 + 3; This is not illegal in C, but it has no any effect (eventually, you will be warned by the compiler that the statement has no effect, if you enable enough strong warning checking). Such misinterpretations are very often with newbie users, so I will elaborate this in more details. Suppose that you wrote key = ngetchx; You probably want to call ngetchx function to get a keypress, but instead, you will assign the address of this function to the variable ‘key’, because the function name witho

Related Questions

What is your question?

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

Experts123