INF: Formal Parameters Default to Type int

ID Number: Q51198

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

In Microsoft C versions 5.1, 6.0, 6.0a, 6.0ax, and C/C++ version 7.0,

a function declaration such as the following does not generate a

compiler error even though the variable "voida" is not referenced:

void main (voida)

{

}

More Information:

The C and QuickC compilers do not generate an error because the

variable "voida" defaults to a variable of type int. The compilers

understand the above function definition because they recognize the

"old style" of ANSI C declarations as well as the new. In general, the

equivalents of the above code are as follows:

Old Style New Style

--------- ---------

void function (voida) void function (int voida)

int voida <- default if missing {

{ }

}

Please refer to "The C Programming Language" by Brian Kernighan and

Dennis Ritchie for a discussion on differences between old and new

style with regards to function definition.

Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00 S_QUICKC