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]
4 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]4 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
What kind of animation is used in the powerpuff girls show??
konstantin123 [22]
Calarts? Cartoon I don’t really know but that’s all the information that I have
8 0
3 years ago
5 steps in cleaning and sanitizing smokehouse​
topjm [15]

Answer:

  1. Scrape or remove food bits from the surface.
  2. Wash the surface.
  3. Rinse the surface.
  4. Sanitize the surface.
  5. Allow the surface to air-dry.

Explanation: These are steps for cleaning and sanitizing.

4 0
3 years ago
Help me will give brainliest. So can you do number 2 about gaming please
zvonat [6]

Answer: Some insights big data can provide about my hobby, gaming, is what year a certain game was created or the number of purchases made in a year. These insights can make things better for me by knowing what versions to receive first and what's the best game to get. Although, some ways big data can make it worse is by not understanding what the information is saying due to a lack of data or context. They can also make it worse by data and system errors, causing problems for me due to the decisions I make off of it.  

I hope this helped!

Good luck <3

4 0
3 years ago
What is the definition of a protocol, as it applies to networks?
natulia [17]
AN example would be htt
5 0
4 years ago
Joaquin is considering a career as an animator and wants to know more about the daily work of an average animator. Which strateg
Advocard [28]
Lacking a response to my question, I'll assume there's no "correct' answer here. 

Joaquin could contact the university's graphic arts department, or if he's interested in the programming side of it, the computer science department, and ask if they have any information on the topic. If he's already majoring to become an animator, then he should talk to one of his professors to see if they know someone in the business that would speak with Joaquin. 

The faster and better way would be to go to reddit, or some site at which animators congregate (most probably found through Google), read the forums, and create if he's not finding a suitable answer.
3 0
4 years ago
Other questions:
  • Why is it best to run antivirus scans when the computer isn't being utilized?
    7·1 answer
  • What is the definition of legal intrusion
    14·1 answer
  • Word 2013 opens, by default, on a blank document?
    13·2 answers
  • Write a program that opens a text le called quiz.txt for reading. This le contains a single line with a student's rst name then
    15·1 answer
  • The _____ model of a systems development life cycle provides for progressive development of operational software, with each rele
    8·1 answer
  • TRUE OR FALSE!!! <br> Your location can be tracked via your digital footprint.
    9·1 answer
  • The file format that an application can always open a named collection of data on a storage medium such as a hard disk or usb fl
    13·1 answer
  • Write a function in Java to implement the following logic:
    13·1 answer
  • Match the correct answers with the statements.
    14·2 answers
  • Besides entering a URL to go directly to a website, what else can you enter in a browser address bar to explore the internet?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!