INFO: Formal Parameters Default to Type intLast reviewed: October 7, 1997Article ID: Q51198 |
The information in this article applies to:
SUMMARYIn Microsoft C, a function declaration such as the following does not generate a compiler error even though the variable "voida" is not referenced:
void main (voida)
{
}
NOTE: This is true only for the C compiler, not the C++ compiler.
MORE INFORMATIONThe 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 query words: 8.00 8.00c 9.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |