...
Data-Structures
October 16, 2023
Data-Structures
October 16, 2023
Data-Structures
October 16, 2023
Data-Structures
October 16, 2023

Data-Structures

Question 42

Consider the following declaration of a two dimensional array in C:

          char a[100][100];    

Assuming that the main memory is byte-addressable and that the array is stored starting from memory address 0, the address of a [40][50] is:

A
4040
B
4050
C
5040
D
5050
Question 42 Explanation: 
Address for a[40][50] = BaseAddress + [40 * 100 * element size] + [50 * element size]
= 0 + [40 * 100 * 1] + [50 * 1]
= 4000 + 50
= 4050

Correct Answer: B
Question 42 Explanation: 
Address for a[40][50] = BaseAddress + [40 * 100 * element size] + [50 * element size]
= 0 + [40 * 100 * 1] + [50 * 1]
= 4000 + 50
= 4050

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!