0

I came across the following code in Advanced C: Tips and Techniques book.

main()
{
    int a=3, b=4;

    func(&a, &b);
}

func(pa, pb)
int *pa, *pb;
{
    int m = 5, n = 6;
}

First time, I see this kind of function definition. When I compiled following is the warning/error

Anderson.c: In function ‘main’:  
Anderson.c:8:2: warning: implicit declaration of function ‘func’ [-Wimplicit-function-declaration]  
  func(&a, &b);  
  ^~~~  
Anderson.c: At top level:  
Anderson.c:11:1: warning: return type defaults to ‘int’ [-Wimplicit-int]  
 func(pa, pb)  

I know what these warnings are.

I'm here to know more about the way the author had defined the function. what would be the benefit of this & what's behind author's motive?

I don't see anything other than function name & arguments in different line.
I can just ignore as another gimmick, but the title of the book forced me to know from experts before I ignore.

RRON
  • 1,037
  • 3
  • 12
  • 32
  • 8
    That's a really, really old book. Did you check the copyright date? The style of arguments goes back more than 20 years and is a syntax no longer used in C. Ignore it and reference a newer C book. – lurker Dec 24 '19 at 01:19
  • 2
    [The Definitive C Book Guide and List](//stackoverflow.com/q/562303) – 001 Dec 24 '19 at 01:21
  • 2
    Put that book in a museum, you really need a newer book :) Not only the language changed significantly, but also the possibilities of what's a compiler is able to do – Daniel Jour Dec 24 '19 at 01:23
  • Just realized its pretty old. Thanks !! – RRON Dec 24 '19 at 01:43

0 Answers0