Asked by Kristina Singh on Jun 24, 2024
Verified
If pt is declared as a pointer to a structure of type Employee, ____ refers to the idNum member of the structure.
A) (*pt) .idNum
B) *pt.idNum
C) *(pt.idNum)
D) (*pt.) idNum
Pointer To Structure
A type of pointer in C or C++ that holds the memory address of a structure, allowing access to its members.
IdNum Member
An attribute or variable within a class or struct in programming that holds or represents an identification number.
Type Employee
Refers to a data type, typically a struct or class, representing an employee, including attributes such as name, ID, and position.
- Utilize structures alongside pointers for the purpose of direct data manipulation.
Verified Answer
NG
Nyjaha GipsonJul 01, 2024
Final Answer :
A
Explanation :
The correct syntax to access a member of a structure through a pointer is using the arrow operator (->) or by dereferencing the pointer followed by the dot operator. Since the arrow operator is not presented in the options, the correct way is to dereference the pointer first and then use the dot operator to access the member, which is done by `(*pt).idNum`.
Learning Objectives
- Utilize structures alongside pointers for the purpose of direct data manipulation.