I've been confused with what I see on most C programs that has unfamiliar function declaration for me.
void *func_name(void *param){ ... }
What does *
imply for the function? My understanding about (*
) in a variable type is that it creates a pointer to another variable thus it can be able to track what address at which the latter variable is stored in the memory. But in this case of a function, I don't know what this *
asterisk implies.
The asterisk is a commonly used wildcard symbol that broadens a search by finding words that start with the same letters. Use it with distinctive word stems to retrieve variations of a term with less typing.
In computer programming, a dereference operator, also known as an indirection operator, operates on a pointer variable. It returns the location value, or l-value in memory pointed to by the variable's value. In the C programming language, the deference operator is denoted with an asterisk (*).
The asterisk is an operator in Python that is commonly known as the multiplication symbol when used between two numbers ( 2 * 3 will produce 6 ) but when it is inserted at the beginning of a variable, such as an iterable, like a list or dictionary, it expands the contents of that variable.
While * means the address of a variable in C programming language, what does ** mean then? Actually, & means the address of a variable. * means the value at an address, which also known as dereferencing. In that sense, ** just is dereferencing twice.
The asterisk belongs to the return type, and not to the function name, i.e.:
void* func_name(void *param) { . . . . . }
It means that the function returns a void pointer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With