[Haifux] pop(queue) fails

Orr Dunkelman orr.dunkelman at gmail.com
Sun Oct 26 11:20:16 MSK 2008


To all of you who missed the point of my message:

The lecture queue is empty. There are no lectures.

Please, if you want to give a lecture, contact us at
webmaster at haifux.org with title and abstract (and possible dates).

Cheers,

On Sun, Oct 26, 2008 at 7:00 AM, Tal Abir <tal.abir at gmail.com> wrote:
> The code doesn't compile.
> The function pop doesn't return value in all cases.
>
> I think you've compiled and run some other project.
>
> Hope it helps,
> Tal.
>
> On Sat, Oct 25, 2008 at 5:01 PM, Orr Dunkelman <orr.dunkelman at gmail.com>
> wrote:
>>
>> hi guys,
>>
>> I have some issues with the following code, help would be appreciated.
>>
>> #include <stdio.h>
>>
>> struct Lecture {
>>   char Lecturer[80];
>>   char Topic[160];
>>   char Date[30];
>> } lecture-str;
>>
>> struct Node {
>>   lecture-str data;
>>   Node *next, *prev;
>> } node-str;
>>
>> struct Queue {
>>   Node First;
>>   int size;
>> } Queue-str;
>>
>> /* standard stuff */
>>
>> int pop (Queue-str Haifux)
>> {
>>   Node ptr*;
>>   if (Haifux->size == 0) { printf ("No lecture in queue\n"); return -1;
>>
>>   print_node (Haifux->First);
>>   ptr=Haifux->First;
>>   Haifux->First = Hiafux->First.next;
>>   free (ptr);
>>
>>   size --;
>>   if (size)   Haifux->First.prev=NULL;
>> }
>>
>> =====================================================================
>>
>> Well, the code failed with the error message
>>
>>   No lecture in queue
>>
>> Help, somebody?
>>
>> --
>> Orr Dunkelman,
>> Orr.Dunkelman at gmail.com
>>
>> "a scientific man ought to have no wishes, no affections, -- a mere
>> heart of stone" - Charles Darwin.
>>
>> GPG fingerprint: C2D5 C6D6 9A24 9A95 C5B3  2023 6CAB 4A7C B73F D0AA
>> (This key will never sign Emails, only other PGP keys. The key
>> corresponds to orrd at vipe.technion.ac.il)
>> _______________________________________________
>> Haifux mailing list
>> Haifux at haifux.org
>> http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux
>
>



-- 
Orr Dunkelman,
Orr.Dunkelman at gmail.com

"a scientific man ought to have no wishes, no affections, -- a mere
heart of stone" - Charles Darwin.

GPG fingerprint: C2D5 C6D6 9A24 9A95 C5B3  2023 6CAB 4A7C B73F D0AA
(This key will never sign Emails, only other PGP keys. The key
corresponds to orrd at vipe.technion.ac.il)



More information about the Haifux mailing list