Difficulty: Easy
Correct Answer: 103 DotNet
Explanation:
Introduction / Context: This problem checks understanding of array indexing with structs and pointer arithmetic on arrays of structs.
Given Data / Assumptions:
Concept / Approach: c[1] indexes the second struct in the array. c + 2 points to c[2], and *(c + 2) dereferences that element. Accessing fields then prints the stored number and string.
Step-by-Step Solution:
c[1].courseno = 103 *(c + 2) is c[2]; c[2].coursename = "DotNet" Output: "103 DotNet"Verification / Alternative check: Rewriting (*(c+2)).coursename as c[2].coursename yields the same result by array indexing equivalence.
Why Other Options Are Wrong:
Common Pitfalls: Off-by-one mistakes when moving between zero-based indexing and pointer arithmetic (c + n vs c[n]).
Final Answer: 103 DotNet
Discussion & Comments