Using Zero as a Value
typedef enum
{
nullday=0,
sun,
mon,
tue,
wed,
thu,
fri,
sat
} MahonriDays;
|
*
"I'd have started with -1 as 'undefined day'. Beware that programmers start counting at 0. ;-)"
--SO/alk
|
|
Casting Void
int MahonriFree(void **ptr)
{
free(*ptr);
*ptr=NULL;
}
MahonriFree((void **)&a);
|
*
"@MahonriMoriancumer. That's **UB. Your MahonriFree must cast ptr back to its actual type (which it is ignorant of)."
--SO/mafso
**UB : undefined behavior
|
|