Default "C" subroutine values
Posted: Thu Nov 07, 2013 5:35 pm
I am writing a routine library for VG graphics.
Is there a way in "C" to mimic how PHP allows default values for a subroutine call.
Suppose I have a subroutine for writing a Point at x,y with a color.
If the call is made without a color, I would like a default color to be assigned.
PHP example
call routine without color
Pointxy(x,y,) // notice missing color
php subroutine definition
Pointxy(x,y, color="black"); // php sub will assign "black" if value not passed
Can this be done in "C"?
Is there a way in "C" to mimic how PHP allows default values for a subroutine call.
Suppose I have a subroutine for writing a Point at x,y with a color.
If the call is made without a color, I would like a default color to be assigned.
PHP example
call routine without color
Pointxy(x,y,) // notice missing color
php subroutine definition
Pointxy(x,y, color="black"); // php sub will assign "black" if value not passed
Can this be done in "C"?