A structure variable named address contains a member variable named strStreet. Which of the following statements assigns the string “Maple” to the member variable?

The correct answer is B. address.strStreet = “Maple”.

A structure is a data type that can contain multiple variables of different data types. The variables in a structure are called members. To access a member of a structure, you use the dot notation. The dot notation is a way of accessing the members of an object. The syntax for the dot notation is:

object.member

In this case, the object is address and the member is strStreet. So, to assign the string “Maple” to the member strStreet, you would use the following statement:

address.strStreet = “Maple”

The other options are incorrect because they do not use the dot notation. Option A, address&strStreet = “Maple”, is incorrect because it uses the ampersand (&) operator. The ampersand operator is used to perform pointer arithmetic. Option C, strStreet.address = “Maple”, is incorrect because it uses the dot notation to access the member address, but the member address does not exist. Option D, strStreet&address=”Maple”, is incorrect because it uses the ampersand operator to access the member address, but the member address does not exist.

Exit mobile version