d. int back(BrowserList browserList) which moves pCurrentURL \"back\" one page.
ID: 3592858 • Letter: D
Question
d. int back(BrowserList browserList) which moves pCurrentURL "back" one page. It returns TRUE if this completed successfully and returns false otherwise (e.g. the node doesn't exist). int forward(BrowserList browserList) which moves pCurrentURL "forward" one page. It returns TRUE if this completed successfully and returns false otherwise (e-g. the node doesn't exist). e. f. void printBrowserList (BrowserList browserList) which prints the contents of the BrowserList with one URL per line, placing *'s around the current URL. If we printed the final list in the example, we would have:Explanation / Answer
#include #include #include #include //#define constant values #define MAX_URL_LENGTH 50 #define TRUE 1 #define FALSE 0 //typedef for the Element struct which constains a c string to store a URL in the BrowserList typedef struct { char szURL[MAX_URL_LENGTH]; } Element; //Typedef for a node in the doubly linked list (has next and previous pointers). typedef struct NodeDL { Element element; struct NodeDL *pNext; struct NodeDL *pPrev; } NodeDL; //Typedef for a doubly linked list implementation. //Contains a pointer to the first node in the list and the last node in the list (pHead and pFoot respectively). typedef struct { NodeDL *pHead; NodeDL *pFoot; } DoublyLinkedListImp; typedef DoublyLinkedListImp *DoublyLinkedList; /typedef for a BrowserListImp which stores a DoublyLinkedList of all of the URLs visited plus a pointer //to the node containing the current webpage. typedef struct { DoublyLinkedList list; NodeDL *pCurrentURL; } BrowserListImp; typedef BrowserListImp *BrowserList;Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.