(10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
// Using Pointers with a struct
#include <iostream>
struct ListElement
{
int value;
ListElement* pNext;
};
void PrintList(ListElement* p)
{
while (p != NULL)
{
std::cout << p->value;
p = p->pNext;
}
}
int main()
{
ListElement LE5 = { 5, NULL };
ListElement LE4 = { 4, &LE5 };
ListElement LE3 = { 3, &LE4 };
ListElement LE2 = { 2, &LE3 };
ListElement LE1 = { 1, &LE2 };
PrintList(&LE1);
return 0;
}