What is the output of the following piece of C++ code?
发布于 2022-03-03 11:06:29
What is the output of the following piece of C++ code?
using namespace std struct Item { char c Item *next } Item *Routine1(Item *x) { Item *prev = NULL, *curr = x while (curr) { Item *next = curr->next curr->next = prev prev = curr curr = next } return prev } void Routine2(Item *x) { Item *curr = x while (curr) { cout << curr->c << ” “ curr = curr->next } } int main(void) { Item *x, d = {‘d’, NULL}, c = {‘c’, &d}, b = {‘b’, &c}, a = {‘a’, &b} x = Routine1(&a) Routine2(x) return 0 }
登录后免费查看答案
关注者
0
被浏览
13