Question: Problem 3 . ( 4 points ) : This problem concerns the indexing of C arrays. Consider the C code below, where N is a

Problem 3.(4 points):
This problem concerns the indexing of C arrays.
Consider the C code below, where N is a constant declared with #define.
int foo (int A[16][N], int i, int j)
{
return A[i][j];
}
Suppose the above C code generates the following assembly code:
foo:
push1%ebp
movl %esp,%ebp
movl 8(%ebp),%ecx
movl 16(%ebp),%edx
movl 12(%ebp),%eax
sal1 $2,%edx
sal1 $3,%eax
subl 12(%ebp),%eax
leal (%edx,%eax, 4),%eax
movl %ebp,%esp
popl % ebp
movl (%ecx,%eax),%eax
ret
What is the value of N?
N=
 Problem 3.(4 points): This problem concerns the indexing of C arrays.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!