JasonWB007
Programmer
Hi,
Looking through some code, I found a function of the format:
int function (parms..., (void *)0, parms...);
Is this legal? I have a need to pass a constant to a function and I really don't want to define a variable to hold it. I have a function that will either read or write a device. When I read the device, I pass it a pointer to the variable to hold the result (return value is status of success or failure), but when I write to it, I would like to simply pass it a constant sometimes, not the address of a variable. Why is the above OK (it seems to work)?
Thanks,
Jason
Looking through some code, I found a function of the format:
int function (parms..., (void *)0, parms...);
Is this legal? I have a need to pass a constant to a function and I really don't want to define a variable to hold it. I have a function that will either read or write a device. When I read the device, I pass it a pointer to the variable to hold the result (return value is status of success or failure), but when I write to it, I would like to simply pass it a constant sometimes, not the address of a variable. Why is the above OK (it seems to work)?
Thanks,
Jason