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
Alborosie
3 years ago
8

Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the

number of elements to allocate. The function should return a pointer to the array. Call the function in a complete program.
Computers and Technology
1 answer:
viktelen [127]3 years ago
5 0

Answer:

#include <iostream>

#include <cstdlib>

using namespace std;

int* integerArr( int number);

int main(){

   int* address;

   address = integerArr(5);

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

     cout << "Address of the integer array:  ";

     cout << *(address + i) << endl;

   }

   return 0;

}

int* integerArr( int number){

   int myArr[number];

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

     myArr[i] = rand();

   }

   int* ptr= myArr;

   return ptr;

}

Explanation:

The C++ source calls the defined pointer function "integerArr" with an integer argument to declare arrays of dynamic length, in the main function of the program and the items of the array are printed on the screen.

You might be interested in
What are some other possible causes of an overheating laptop
ella [17]
Too much use, air vents are being covered, dust/dirt/other particles clogging the fan making it struggle too cool the laptop down, the internal battery may be low and struggling to function, etc.


I hope this helps you!
8 0
3 years ago
Tell me everything that happened in the fortnight galactics event. WHO EVER HAS THE BEST EXPLANATION WILL GET BONUS POINTS AND W
ryzh [129]

Answer:

people still play fortnight?!?!

Explanation:

psn: Smallboy_life

7 0
3 years ago
Cnt115-02* which of the following is a private ip address and can't be routed across the internet?
vichka [17]
192.168.90.100 can't be routed via across the internet
7 0
3 years ago
n 3 to 4 sentences, write a note to a friend describing how to move text from one part of a document to a different part of the
EleoNora [17]
Select the part you want to move.  Highlight it, and click ctrl+x.  Then, go to the place you want to put it.  Click ctrl+v.  It should be cut and pasted
8 0
3 years ago
Read 2 more answers
You have a limited budget and you need to type color documents frequently, which type of printers would you buy?​
Natali [406]

Answer:

you can use these printer if you have this amount of budget

Explanation:

7 0
3 years ago
Other questions:
  • How do you represent the decimal integer 50 in binary?
    14·1 answer
  • Which of the following statements isNOT true about abstract data types (ADTs)?A list is anexample of an ADT.ADTs hide theimpleme
    7·1 answer
  • A user printed several documents to a shared network copier and noticed that they have very faint color density. A technician in
    9·1 answer
  • Which statement describes part of the meeting scheduling process? It is always an all-day event. It is created in a single calen
    14·1 answer
  • What is Telerobotic?
    10·2 answers
  • Taylor is getting ready to send an e-mail. In three to five sentences, give Taylor some advice for sending an effective email.
    13·1 answer
  • Who wrote the book of luke​
    7·1 answer
  • Write a python program to find the volume of the pepsi present in the can which is in the shape of cylinder accepting the radius
    11·2 answers
  • What is the importance of test documentation?
    15·2 answers
  • The designers of a database typically begin by developing a​ __________ to construct a logical representation of the database be
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!