Search code examples
cfunction-prototypes

declaring a function with this specification


i recently saw the following code in C which is said to be valid but I'm not sure.

    int max(x,y)
    int x,y;
    {
    return (x>y)?x:y;
    }

Is this kind of function prototype valid? If so please give some reference to learn more about that.


Solution

  • This is the old-style "K&R" way of defining functions. The new way is better, so don't write code like this yourself.