2

How Does C Allows declaring type of argument after Closed Bracket like below Code?. The below Code is actually compiling and Executing without any error. How does this generally Work?

#include <stdio.h>

void print_int(num)
int num;
{
    printf("\n\n\nNumber : %d\n\n",num);
}

int main(argc,argv)
int argc;
char** argv;
{
    print_int(2);
    return 0;
}
  • 6
    That's a really old, 70's and 80's era pre standard style of function definition. It works because of backwards compatibility in compilers. Not sure it's even in the last few versions of the standard. – Shawn Apr 14 '19 at 13:15
  • 1
    This is the old style, is the K&R C I guess – geckos Apr 14 '19 at 13:16
  • Yes i saw this kind of syntax when i was going through the source code of gnu utils and iptables. – Sadaananth Anbucheliyan Apr 14 '19 at 13:16

0 Answers0