Code:struct pqueue { struct entry entries[10]; }pqueue; How can i check if the entry array "entries" is empty? int isEmpty(struct pqueue* pqueue) (<- i have to use this function for this) { something like= if (pqueue.entries[10] = 0) ?
Code:struct pqueue { struct entry entries[10]; }pqueue; How can i check if the entry array "entries" is empty? int isEmpty(struct pqueue* pqueue) (<- i have to use this function for this) { something like= if (pqueue.entries[10] = 0) ?
Easiest and simplest way is to just do
Then it's simplyCode:struct pqueue { int numEntries; struct entry entries[10]; }pqueue;
Code:int isEmpty(struct pqueue* pqueue) { return pqueue->numEntries == 0; }
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.