[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CVoid
In C, int myFunction(void); is the declaration of a function taking no arguments. In C++, int myFunction(); is preferred (see below) to specify this. In C, however, there is a difference between the two, as in C, int myFunction(); denotes a function declaration taking ANY number of unspecified parameter.
Here a (modified) example submitted by stober:
Sorry, I haven't got a better example. I need to look in some Win32 API programming for one).
Avoid ?void* except in low-level code.
See ?void* for more details.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CVoid
(C) void
Keyword denoting that either- The function returns nothing
- The function takes no arguments
- The function returns a ?pointer of unknown type.
The function returns nothing
void sayHello()
{
printf("Hello world");
}
The function takes no arguments
(From the C++ MessageBoard, http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=3&MsgID=339047&Setting=P0030F0001, thanks to stober)In C, int myFunction(void); is the declaration of a function taking no arguments. In C++, int myFunction(); is preferred (see below) to specify this. In C, however, there is a difference between the two, as in C, int myFunction(); denotes a function declaration taking ANY number of unspecified parameter.
Here a (modified) example submitted by stober:
void func1();
void func2(void);
int main(void)
{
int a = 0;
int b = 0;
func1();
func1(a);
func1(a,b);
func2(a); //Error on this line! func2 has no arguments!
}
The function returns a pointer of unknown data type
void* someFunction();(
Avoid ?void* except in low-level code.
See ?void* for more details.
'void' links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
