Use the C programming language. I plan on converting this to x86-64 assembly lon
ID: 3701552 • Letter: U
Question
Use the C programming language. I plan on converting this to x86-64 assembly
long QArray1[10];
long QArray2[10];
The main will contain the two arrays above and also call to the other user defined functions presented below.
int main();
long readArrays(long *array_ptr1, long *array_ptr2);
void printQArray(long count, long *array_ptr, long *header_literal_address);
void printIntSquares(long count, long *array_ptr, long *header_literal_address);
The readArrays will populate QArray1 and QArray2 with values and will return count to main().
The printQArray procedure will be called twice from main(): the first time with the size of the arrays, the address to QArray1 and an address to a string literal that says “Elements in QArray1 ”. The function should then print each 8?byte value in the array in order on a separate line with a blank line following all of the values in the array. The second time that the function is called, it should be passed the size of the arrays, the address to QArray2 and an address to a string literal that says “Elements in QArray2 ”, then printing each of the values in QArray2.
The printIntSquares() function will also be called twice from main(): the first time with the size of the arrays, the address to QArray1 and an address to a string literal that says “2? byte Squares in QArray1 ”; the second time with the size of the arrays, the address of QArray2 and an address to a string literal that says “2?byte Squares in QArray2 ”. The printIntSquares() function will read an 8?byte element from an array, then multiply the value by itself. After the multiplication, printIntSquares() will determine whether or not the product will “fit” in a 2?byte integer value. If so, then printIntSquares() should print out the value. If the product will not fit in a 2?byte integer, printIntSquares() should print out the string “overflow” rather than a number.
Explanation / Answer
#include <stdio.h>
#include<string.h>
int main()
{
long QArray1[10];
long QArray2[10];
int count;
count=long readArrays(long *array_ptr1, long *array_ptr2);
printf(“ value of count = %d”, count);
void printQArray1(long count, long *array_ptr, long *header_literal_address);
void printQArray2(long count, long *array_ptr, long *header_literal_address);
void printIntSquares(long count, long *array_ptr, long *header_literal_address);
void printIntSquares1(long count, long *array_ptr, long *header_literal_address);
}
long readArrays(long *array_ptr1, long *array_ptr2)
{
int count1;
}
void printQArray1(long count, long *array_ptr, long *header_literal_address)
{
int i = 1, *array_ptr = &array_ptr;
void printQArray2(long count, long *array_ptr, long *header_literal_address)
{
int i = 1, *array_ptr = &array_ptr;
void printIntSquares(long count, long *array_ptr, long *header_literal_address)
int i = 1, *array_ptr = &array_ptr;
void printIntSquares1(long count, long *array_ptr, long *header_literal_address)
{
int i = 1, *array_ptr = &array_ptr;
{
Printf(“ Value is fit”)
}
else
{
printf(“ OVERFLOW ”);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.