Nov 16, 2007 20:16
What is wrong with the following code?
This was from an interview.
(Now RFC 3092 compliant).
int* head = 0;
int* tail = 0;
struct foo{
int bar;
int *pNext;
}baz;
insert ( int qux ) {
baz* quux;
quux = malloc( sizeof(baz) );
quux->bar = qux;
if (head == tail ) {
head = quux;
tail = quux;
}
/* rest of insert */
}
programming