what does the void command mean and how do you use it in programming?
Sorry for being such a noobie ^^;
This is a discussion on void within the C++ Programming forums, part of the General Programming Boards category; what does the void command mean and how do you use it in programming? Sorry for being such a noobie ...
what does the void command mean and how do you use it in programming?
Sorry for being such a noobie ^^;
Be inspired.
Here is an example of when void would be used:
this is just one example of it's use in a function, but void has one golden rule:Code:#include <iostream> using namespace std; void example() // example is a function, but I have voided it so it returns nothing to main int main() { example(); // this calls the function example return 0; } void example() // you can now use the function as main has called it { code for exapmle would go here{ return; // return nothing to main as example is void }
Never use the command 'void main()' as main must ALWAYS return an integerger or int
void means no type. As in, no return type for a function, so it doesn't have to return anything. Or a void pointer can be casted into a pointer of any other type.