1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SashulF [63]
2 years ago
7

Write a C function named apply_all that expects two arrays of integers and their sizes and dynamically allocates a new array of

integers whose size is the product of the 2 array sizes. The function should loop through the second array and multiplies each element across each element of array 1 and store the product in the newly created array. The function should return a pointer to the newly allocated array.
Computers and Technology
1 answer:
andrew-mc [135]2 years ago
5 0

Answer:

The function C is as follows:

int *apply_all(int arr1[], int arr2[], int size) {

  int result[size];

  for(int i =0; i<size;i++){

      result[i] = arr1[i] * arr2[i];

      printf(" %d", result[i]);

  }

  return result;

}

Explanation:

This line defines the function

int *apply_all(int arr1[], int arr2[], int size) {

This declares an array that holds the result of the function

  int result[size];

This iterates through the array

  for(int i =0; i<size;i++){

This multiplies the corresponding elements of both arrays

      result[i] = arr1[i] * arr2[i];

This prints the result of the multiplication

      printf(" %d", result[i]);

  }

This return the a pointer to the new array

  return result;

}

<em>See attachment for complete program that includes the main</em>

Download cpp
You might be interested in
The Internet of Things (IoT) is a concept with emphasis on machine-to-machine communications to describe a more complex system t
VLD [36.1K]

Answer:

IoE(Information of Everything)  is the correct answer to the following question.

Explanation:

The following answer is correct because it is the concept that process, data, people and also Internet of Things brings together by which the network connection become more valuable and more compatible as compared to before and also it can extend the IoT(Internet of Things).

So, that's why the following answer is correct.

8 0
3 years ago
Please write a code for below:
Zanzabum

Answer:

int main()  

{  

   int x,y;  

   bool b1, b2;  

   cout<<"enter values of x : ";

   cin>>x;

   cout<<"enter values of y : ";

   cin>>y;

   b1 = y > x; // false  

     

   b2 = x > y; // true  

     

   cout << "b1 is = " << b1 << "\n";  

   cout << "b2 is = " << b2 << "\n";  

     

   if (b2)  

       cout<<endl << "Larger Number" << "\n";  

   else

       cout << "Smaller Number" << "\n";  

         

     

return 0;  

}

8 0
3 years ago
1. Why does a computer have different types of ports?
iren2701 [21]

Answer:

Computer ports are classified into two types based on the protocols used. A protocol is a set of rules and standards to be followed during data transfer and communication. Usually, data is transmitted in a particular pattern.

Explanation:

3 0
2 years ago
Read 2 more answers
An object completes one round of circle of radius 7m in 20 sec. Distance travelled after 10 sec is? ​
Ivanshal [37]

Answer:

distance \: travelled \:  = 2\pi \\  \\ 44cm \:  \:  \:  \:  \\ speed \:  =  \frac{44}{2.2}  \ \\ distance \: travelled \: in \: los = 10 \times 2.2 = 22cm \\  \\ total \: distance = 44 + 22 = 66metres

5 0
2 years ago
A​ ___________ identifies the content and purpose of the​ visual, along with whatever label and number​ you're using to refer to
Westkost [7]

Answer:Title

Explanation: Title is basically considered as the "heading" or the "topic" that is used for giving the hint about the content or visual. In context with the visual ,which is the piece of display where title determines about the reason of visual and also hints about the content .It also gives the reference number that a person assign to the visual.

7 0
3 years ago
Other questions:
  • How will a packet tracer environment be affected if a heater is added to a container named branch office and turned on?
    5·1 answer
  • To add text to a slide when using presentation software, you need to add a text box. To add a text box, click the Text Box butto
    6·2 answers
  • You should use the longest possible shutter speed for all firework photographs.
    8·2 answers
  • What should you do prior to writing your business document?
    11·1 answer
  • What is the importance of Mathematical Modeling in the field of bioinformatics.
    8·1 answer
  • Computer with a domain name is called a
    7·1 answer
  • Write a program in c++ that asks the user for a sequence of n​integers, where the user provides the number of elements n​ then e
    12·1 answer
  • Select the correct answer.
    11·1 answer
  • Write a program that lets the user enter a nonnegative integer then uses a loop to calculate the factorial of that number. Displ
    11·1 answer
  • Compare and contrast two fundamental security design principles in network security. Analyze how these principles and how they i
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!