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

前端 未结 3 990
情深已故
情深已故 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:29

    K&R-style function declaration:

    void foo(n) 
        int n; 
    {
    
    }
    

    If type isn't specified, it defaults to int. This is valid in C89, not C99

提交回复
热议问题