Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Required Files: https://www.dropbox.com/s/94fiir6i6h13bt9/Assignment%203%20Requi

ID: 652872 • Letter: R

Question

Required Files: https://www.dropbox.com/s/94fiir6i6h13bt9/Assignment%203%20Required%20Files.zip?dl=0

Description

In this exercise set we will practice with various kinds of pointers: doubly-indirect pointers, an array of pointers that must be indexed into, pointers as arguments, pointers to functions, and even use two pointers that go in different directions. The program will rely on util.s

diff.s (You will need this program for Assignment Three)

Beginning with the data areas defined in the file diff.s, write this program as follows:

? The main program calls a function

void doit(int *Result, int A[], int B[], int nelems)

The quantity nelems should be calculated by assuming the array B starts immediately after the array A,and that A and B are the same length. The array Result must be dynamically allocated by main() using sbrk(). It must be be the same length as A. (You will see that Result is not defined in the beginning copy of diff.s.) Note that the three arguments Result, A and B are the same type - equivalently pointer to an integer or array of int. (The only way that doit could fail is if one of its arguments was invalid, so we won

Explanation / Answer

The following link does not contains files

https://www.dropbox.com/s/94fiir6i6h13bt9/Assignment%203%20Required%20Files.zip?dl=0

Even then I am providing following answer

#include<stdio.h>
#include<conio.h>

int diff(int x, int y)
{
   return(x-y);
}
void doit(int result[], int a[], int b[])
{
   int i;
   for(i=0;i<5;i++)
   {
       result[i] = diff(a[i],b[i]);
   }
   printf(" Result is");
   for(i=0;i<5;i++)
   {
       printf(" %d",result[i]);
   }
   getch();
}


void main()
{
   int a[5],b[5], result[5],i,c;
   clrscr();

   printf(" Enter 5 no");
   for(i=0;i<5;i++)
   {
       scanf("%d",&a[i]);
   }

   printf(" Enter 5 no");
   for(i=0;i<5;i++)
   {
       scanf("%d",&b[i]);
   }
   doit(result,a,b);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote