恒生电子笔试题3
时间:2025-03-10
时间:2025-03-10
恒生电子笔试题
Pay attention: Don't answer on the sheet, please answer on the blank answer-sheet.
1. Specify what does “func()” do with the list "ppList", and what are the errors.
struct NODE { int nValue; struct NODE* pLeft; struct NODE* pRight; };
struct NODE_LIST { const struct NODE* pNode; struct NODE_LIST* pNext; };
struct NODE_LIST* sub_func(const struct NODE* pTree, struct NODE_LIST* pList) { if (pList == NULL) { pList = malloc(sizeof(struct NODE_LIST)); if (pList == NULL) { return 0; } pList->pNode = pTree; pList->pNext = NULL; return pList; } else { while (pList->pNext) { pList = pList->pNext; } pList->pNext = malloc(sizeof(struct NODE_LIST)); if (pList->pNext == NULL) { return 0; } pList->pNext->pNode = pTree; pList->pNext->pNext = NULL; return pList->pNext; } }
int func(const struct NODE* pTree, struct NODE_LIST** ppList) { int nNum = 0; if (pTree == NULL) {
上一篇:09级电信二班赵晓飞毕业论文