Is not using & with a variable in scanf() a syntax error or a runtime error?

…衆ロ難τιáo~ 提交于 2019-12-02 00:10:21

Depends on compilers intelligence

Some compilers are made intelligent to warn you for such obvious run-time errors

Technically it would be both. It doesn't recognize it as an error until runtime. However as stated on this page scanf expects pointers for the formatted variables therefore not preceding the variable 'a' with (&) is syntactically incorrect. Most would call this a runtime error and that is exactly what I would call it but its not completely wrong to call it a syntax error. It is however more thought of as a runtime error since there is no error until it runs.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!