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
A package that includes hardware, software, and support from a single vendor is called a(n ____ package.
dmitriy555 [2]
The appropriate response is turnkey. It is a kind of venture that is built so it can be sold to any purchaser as a finished item. This is stood out from work to request, where the constructor fabricates a thing to the purchaser's correct determinations, or when an inadequate item is sold with the supposition that the purchaser would finish it.
6 0
3 years ago
To have a set of command
GalinKa [24]

Every program that interacts with people responds to a specific set of commands. The set of commands and the syntax for entering them is called the user interface and varies from one program to another. The DOS operating system makes a distinction between internal and external commands.

3 0
2 years ago
Distinguish<br> between formal and Informal<br> Information System<br> Information systems
Harlamova29_29 [7]

Explanation:

Formal; A formal information system is based on

the organization represented by the organization chart.

Informal; The informal information system is

employee based system designed

to meet personal and vocational needs

and to help in solution of work-related problems.

5 0
2 years ago
Suppose you have a string matching algorithm that can take in (linear)strings S and T and determine if S is a substring (contigu
Zielflug [23.3K]

Answer:

no seishsssssssssssssssssssss

8 0
2 years ago
Read 2 more answers
SOMEONE PLEASE HELP ME I REPOSTED THIS 3 time and no ONE HAD HELPED ME
RoseWind [281]

Answer:

The answer is B

7 0
3 years ago
Other questions:
  • Located toward the right of the status bar and contains buttons for zooming the display in and out
    13·1 answer
  • )a___ is a complete binary tree such that each node in the tree contains a comparable object that us greater than or equal to th
    9·1 answer
  • Write a Temperature class that will hold a temperature in Fahrenheit, and will provide methods to get and display the temperatur
    5·1 answer
  • How many bits are used to direct traffic to specific services running on a networked computer?
    6·1 answer
  • The need to strike a<br>- among work, life, family, and other responsibilities is<br>universal.​
    15·1 answer
  • Can some one help sorry I just so confused on this and I keep failing it I just need the help So choose the best answers
    12·1 answer
  • Who initially developed what is now known as the internet?
    5·1 answer
  • When you pass an argument to a method, the argument's data type must be ____________ with the receiving parameter's data type?
    11·1 answer
  • What is the output?
    7·1 answer
  • Three types of query​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!