Awesome q2a theme
0 votes
15 views

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

char a[50][50];

Assuming that the main memory is byte – addressable and that the array is stored starting from memory address $0$, the address of $a[20][25]$ is:

  1. $2020$
  2. $2525$
  3. $2025$
  4. $2050$
in Others by (53 points)
edited by | 15 views

1 Answer

0 votes

Assuming it to be Row major and the array index starts from 0 and size of int is 2 Bytes, we can solve it as

A[i][j]= base + {i*d2 +j}* (size of int in bytes) ………………… [where A[50][50] = A[d1][d2], so d1= 50, d2=50]

A[20][25] = 0+ {20*50 +25}*2

                =2050

by (1.2k points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Jan 2020
  1. shashin

    1416 Points

  2. Vimal Patel

    377 Points

  3. Deepakk Poonia (Dee)

    350 Points

  4. Debapaul

    276 Points

  5. Satbir

    196 Points

  6. Pratyush Priyam Kuan

    160 Points

  7. tp21

    151 Points

  8. SuvasishDutta

    151 Points

  9. pranay562

    145 Points

  10. DukeThunders

    97 Points

Monthly Top User and those within 60% of his/her points will get a share of monthly revenue of GO subject to a minimum payout of Rs. 500. Current monthly budget for Top Users is Rs. 75.
3,138 questions
1,550 answers
9,401 comments
89,835 users