Why do I have to specify data type each time in C?

后端 未结 11 2752
温柔的废话
温柔的废话 2020-12-12 18:17

As you can see from the code snippet below, I have declared one char variable and one int variable. When the code gets compiled, it must identify t

11条回答
  •  心在旅途
    2020-12-12 18:41

    Compiler may be smart, but functions printf or scanf are stupid - they do not know what is the type of the parameter do you pass for every call. This is why you need to pass %s or %d every time.

提交回复
热议问题