No defined type of a function parameter defaults to int? Am I insane?

前端 未结 3 1026
情深已故
情深已故 2020-11-30 12:46

For some odd reason I was copying an example in another language of which does not use types, and forgot to add one in to a function definition parameter, and it worked.

3条回答
  •  日久生厌
    2020-11-30 13:08

    afaik this is called argument promotion. i do not recall the exact rules, but it comes down to the compiler being allowed to use int for arguments when he (she?) doesn't know the function prototype yet.

提交回复
热议问题