I am supposed to create a little file named queueMain.c and just put the functions provided to use. But for some reason it is giving me an "Arithmetic Exception". What have I done wrong? Right now it is supposed to run queueManage and create a queue called "theQ" with a size of 2. It's then supposed to insert two values into the queue, filling it. Then it is to remove the head value and then run queueManage again to destroy the queue, but for some reason I can't seem to figure out where it is going wrong.
Here is the code I have written. I think I just have some syntax wrong, but for the love of God I can't seem to pinpoint where I have messed up:
#include <stdio.h>
#include "queueHeader.h"
int main (int argc, constchar * argv[])
{
QUEUE theQ;
QUEUE *ptr1 = &theQ;
QUEUE **ptr2 = &ptr1;
//creating the queue
queueManage(&ptr1, 1, 2);
printf("QUEUE of size 2 created");
// adding value to queue
addToQueue(&theQ, 5);
printf("Value 5 has been added to the QUEUE");
// adding another value to queue
addToQueue(&theQ, 3);
printf("Value 3 has been added to the QUEUE");
// Remove the front value from queue
int head = ptr1->head;
removeFromQueue(&theQ, &head);
printf("The front value has been removed from the QUEUE");
//delete the que
queueManage(&ptr1, 0, 2);
printf("QUEUE has been destroyed");
return 0;
}
I have only 1 question: Why are you doing C code, and posting it in a C++ forum? Isn't there a C programming forum somewhere in the Internet? I mean, you even say this is C++, and that pastebin says it is C++, but I don't see one letter of C++!!!