6 questions. Covers Aliasing.
Questions 1 to 5 of 6
cpp #include <cstddef> #include <iostream> struct Mix { char a; short b; char c; }; int main() { std::cout << sizeof(Mix) << ' ' << offsetof(Mix, c) << '\n'; return 0; }
cpp #include <iostream> struct Node { int value; Node* next; }; int main() { Node c{3, nullptr}; Node b{2, &c}; Node a{1, &b}; Node* head = &a; head = head->next; head->next = head->next->next; for (Node* cur = head; cur != nullptr; cur = cur->next) { std::cout << cur->value << '\n'; } std::cout << "a.next->value = " << a.next->value << '\n'; return 0; }
2
a.next->value = 2
1
3
a.next->value = 1
a.next->value = 3
Choose the matching item for each row.
p != nullptr
delete
nullptr
5 question(s) left on this page.