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
makvit [3.9K]
3 years ago
15

Given the variable ip, already declared as a pointer to an integer, write the code to dynamically allocate memory for a single i

nteger value, assign the resulting pointer to ip, and initialize the integer value to 27.
Computers and Technology
1 answer:
stepan [7]3 years ago
8 0

Answer:

In C++:

int *ip;

ip = new int;

*ip = 27;

Explanation:

First of all, let us have a look at the methods of memory allocation to a variable.

1. Compile Time: The memory gets allocated to the variable at the time of compilation of code only. It is also called <em>static </em>allocation of memory.

Code example:

int a = 5;

2. Run Time: The memory is allocated to the variable <em>on the fly </em>i.e. during the execution of the program. It is also called <em>dynamic </em>allocation of memory.

Now, we have to write code for a variable ip, which is an integer pointer to dynamically allocate memory for a single integer value and then initialize the integer value 27 to it.

Initializing a variable means assigning a value to variable for the first time.

Writing the code in C++ programming language:

<em>int *ip;</em>      // Declaring the variable ip as a pointer to an integer

<em>ip = new int;</em>    // Dynamically allocating memory for a single integer value

<em>*ip = 27;  </em> // Initializing the integer value to 27.

You might be interested in
I need a solution for this problem asap.
madreJ [45]

Answer:

Hold on just a second I will be giving soon,

5 0
3 years ago
Question 2/21
chubhunter [2.5K]

Answer:

True.

Explanation:

Bau team is struggling to complete their daily BAU work. If they look for another task which is Value Maximization Scrum then they will loose focus from the BAU work. The team will be confused between two tasks and will not be able to meet either commitments. It is better for them to focus on initial task only.

4 0
3 years ago
Complete the function favoriteFlower(). Note that the program will not run as is because the function is incomplete. The purpose
finlep [7]

Answer:

What Language? Once you respond with a comment, I will be happy to write the code for you. I write code 24/7 (Because I have nothing better to do), so I will wait for you to comment. Also is there any pre-existing code?

Explanation:

6 0
3 years ago
QUESTION 5
Zepler [3.9K]

Answer:

allows users to accomplish tasks such as create text documents.

Explanation:

8 0
2 years ago
In the Word 2016 window, where is the Status bar located?
klasskru [66]

Answer:

I hope this helps

Explanation:

The answer is B

4 0
3 years ago
Other questions:
  • To more easily incorporate methods into a program, it is common practice to store methods in their own classes and files. Then y
    6·1 answer
  • Using Visio, create a Local Area Network (LAN) consisting of 12 computers, a switch, and three printers. The switch should be in
    11·1 answer
  • Describe markings on a road that indicate that it is safe to pass.
    10·1 answer
  • Write a program that asks you to enter some integers, and press "enter" after each one.
    13·1 answer
  • Use the _______ to add a line or circle to your presentation.
    8·1 answer
  • HELP AASAP BRAINLIEST JUST HELP
    13·1 answer
  • Which class members should be declared as public?
    12·1 answer
  • computer have taken over a lot of boring, repetitive and time consuming as well as dangerous jobs.true or false
    7·1 answer
  • Which two choices are examples of trivial file transfer protocol (tftp) use? (choose two. )
    5·1 answer
  • Choose the answer that best completes the visual analogy.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!