Consider the C code below, where H and J are constants declared with #define. (2.5 Points) int array1[H] [J]; int array2

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
correctanswer
Posts: 43759
Joined: Sat Aug 07, 2021 7:38 am

Consider the C code below, where H and J are constants declared with #define. (2.5 Points) int array1[H] [J]; int array2

Post by correctanswer »

Consider The C Code Below Where H And J Are Constants Declared With Define 2 5 Points Int Array1 H J Int Array2 1
Consider The C Code Below Where H And J Are Constants Declared With Define 2 5 Points Int Array1 H J Int Array2 1 (34.28 KiB) Viewed 84 times
Consider the C code below, where H and J are constants declared with #define. (2.5 Points) int array1[H] [J]; int array2[J] [H]; void copy_array(int x, int y) { array2 [x][y] = array1[y][x]; } Suppose the above C code generates the following x86-64 assembly code: # On entry: # %edi = x # %esi = y copy_array: movslq %esi, %rsi movslq %edi, %rdi movq %rdi, %rax salq $4, %rax subq %rdi, %rax addq %rsi, %rax leaq (%rsi,%rsi,4), %rsi leaq (%rdi, %rsi,2), %rsi movl array1(,%rsi,4), %edx movl %edx, array2(,%rax, 4) ret MacBook Pro
Register for solutions, replies, and use board search function. Answer Happy Forum is an archive of questions covering all technical subjects across the Internet.
Post Reply