Asked by Jagmeet Sahota on May 17, 2024

verifed

Verified

Consider the declarations
Int nums[100];
Int *nPtr;
The statement ____ produces the same result as nPtr = nums;.

A) nPtr = &nums[0];
B) nPtr = nums[0];
C) nPtr = *nums[0];
D) nPtr = &nums;

Declarations

Instructions in a program that list variables and their types.

Result

The output or outcome generated after processing data or executing a block of statements in a program.

Statement

A Statement is an instruction that a programming language can execute, typically expressing some action to be carried out.

  • Understand the principle and application of the equivalence between arrays and pointers.
verifed

Verified Answer

KM
Kaylee MorrisonMay 19, 2024
Final Answer :
A
Explanation :
Option A is correct because both statements set nPtr to point to the first element of the array nums. The name of the array, nums, when used without brackets, acts as a pointer to its first element, just like &nums[0].