Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following C code: main ( ) { int A [ 2 ] [ 2 ] [ 3 ] ; int i , j

Consider the following C code:
main (){
int A[2][2][3];
int i,j,k,x;
x=0;
for (k=0; k<3; k++){
for (j=0; j<2; j++){
for (i=0; i<2; i++){
x++;
A[i][j][k]= x;
}}}
x=-1;
when row major is used
A[0,0,0]=1 A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[1,1,2]=12
when column major is used
A[0,0,0]=1 A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[,,]= A[1,1,2]=12
}
Consider the consecutive blocks of memory given above on the right, where each block can keep an integer value. Assuming that A[0,0,0] is stored in the first block, give the elements of the array A that will be stored in these consecutive blocks, together with their value, just before the statement x=-1 is executed.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

=+function g such that A[ x (0, 1): f(x) + g(x)]

Answered: 1 week ago