Arrays - Find Output of Program :: Discussion


9.What will be the output of the program if the array begins 1200 in memory?
A.1200, 1202, 1204
B.1200, 1200, 1200
C.1200, 1204, 1208
D.1200, 1202, 1200
Answer:  Option  B
Explanation:

Step 1int arr[]={2, 3, 4, 1, 6}; The variable arr is declared as an integer array and initialized.

Step 2printf("%u, %u, %u\n", arr, &arr[0], &arr); Here,

The base address of the array is 1200.

=> arr, &arr is pointing to the base address of the array arr.

=> &arr[0] is pointing to the address of the first element array arr. (ie. base address)

Hence the output of the program is 1200, 1200, 1200

Tutorial Link:
Published by:Michael Daani

Comments are not available

Post your comments here:

Optional

Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers