Reputation: 67
Look at this method:
void* matmult (void*)
What does (void*)
mean? I know that the function returns a pointer that points to any data type. But what is this argument being passed? How come there is no argument name being passed?
Upvotes: 3
Views: 256
Reputation: 206
Also sometimes you will see something like:
void* foo(void);
In that case the function is explicitly declaring that it takes no parameters. Why would you do that instead of just leaving out parameters? Absence of parameters, for historical reasons, actually means one void* or int* parameter.
void* foo();
// ... later
foo(x);
That will work and compile, but its unclear that that the variable passed in was not intended.
Upvotes: 2