void( void )
Is there any real use for the ( void ) or do people put it there just out of habit? I tried scripting without them and haven't noticed a difference.
In programming, you'd do a void if you want to run a part of code that doesn't have a return of a value at the end. Like:
void addOne(int a)
{
a += 1;
}
void because there's no return a; (which DinkC doesn't even have) at the end and (int a) because this function has a parameter and it's an integer. You can have returns in a void but then it doesn't return a value.
The second (void) means the function has no parameters which is the case in DinkC. Ie: void doSomething() is the same as void doSomething(void). That basically explains why it says (void).. but since there's nothing you can do to add parameters, it's just there because it should be there, not because there's much need, in DinkC anyway.
void addOne(int a)
{
a += 1;
}
void because there's no return a; (which DinkC doesn't even have) at the end and (int a) because this function has a parameter and it's an integer. You can have returns in a void but then it doesn't return a value.
The second (void) means the function has no parameters which is the case in DinkC. Ie: void doSomething() is the same as void doSomething(void). That basically explains why it says (void).. but since there's nothing you can do to add parameters, it's just there because it should be there, not because there's much need, in DinkC anyway.
I think its like this Void main(void)
It's not. It's void main().
There shouldn't be a void between the (). It's ANSI C to put it in there, but it's ANSI C++ to not put the void in (in fact, C++ requires main return an int value, by definition - there are ways to get around that though).
There shouldn't be a void between the (). It's ANSI C to put it in there, but it's ANSI C++ to not put the void in (in fact, C++ requires main return an int value, by definition - there are ways to get around that though).
can you actually do return statments in dinkc I didn't think it was possible.
You can do return; but you can't return a value or so. It just exits the script.