I am working on code which uses a custom linked list class. The list class has the function:
void linkedList::expire(Interval *interval, int64 currentDt)
{
node *t = head, *d;
while ( t != NULL )
{
if ( t->addedDt < currentDt - ( interval->time + (((long long int)interval->month)*30*24*3600*1000000) ) )
{
// this node is older than the expiration and must be deleted
d = t;
t = t->next;
if ( head == d )
head = t;
if ( current == d )
current = t;
if ( tail == d )
tail = NULL;
nodes--;
//printf("Expired %d: %s\n", d->key, d->value);
delete d;
}
else
{
t = t->next;
}
}
}
What I don't understand is the first line of code in the function:
node *t = head, *d;
How is it that this code compiles? How can you assign two values to a single variable, or is this some shorthand shortcut? head is a member variable of type *node, but d isn't found anywhere else.