Posted by Anonymous on .
What is the output of the following C++ code?
p = list;
cout << p->info << " ";
p = p->link;
cout << endl;
C++ Programming -
That's code to walk through a linked list. I can't say the exact output because I can't see what the variable "list" is.
Also, there are missing braces after the while statement. If the program is run without braces, and list is not null, the iteration will infinitely loop and print the first element over and over.