C function syntax, parameter types declared after parameter list

前端 未结 7 854
一个人的身影
一个人的身影 2020-11-22 12:34

I\'m relatively new to C. I\'ve come across a form of function syntax I\'ve never seen before, where the parameter types are defined after that parameter list. Can someone e

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 13:02

    That's the old-style syntax for parameter lists, which is still supported. In K&R C you could also leave off the type declarations and they would default to int. i.e.

    main(argc, argv)
    char *argv[];
    {
        return 0;
    }
    

    would be the same function.

提交回复
热议问题