Wednesday, October 21, 2009

void keyword








 

 




















void keywordAbsence of type or function arguments


















simple-type-specifier := void




The void keyword can be used as a type specifier

to indicate the absence of a type or as a function's

parameter list to indicate that the function takes no parameters.



When used as a type specifier, it is most often used as a function

return type to indicate that the function does not return a value. It

is also used as a generic pointer (e.g., void*),

although this usage is needed less often in C++ than in C.



C++ does not require that void be used to indicate

that there are no function parameters, but it is often used in this

way for compatibility with C.



Example





void func(void)

{

std::cout << "hello, world\n";

}






See Also



declaration, type, Chapter 2, Chapter 5
















     

     


    No comments: