When I try to turn the calculator off using off function from system.h, nothing happens. What is wrong?
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
- When I try entering the login details with the on-screen keyboard nothing happens. What am I doing wrong?
- When I try to turn the calculator off using off function from system.h, nothing happens. What is wrong?
- When I try to use the touch control to turn the fixture on and off, it doesn work. What is wrong?