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
sales reps at universal containers use salesforce on their mobile devices. They want a way to add new contacts quickly and then
Mamont248 [21]

Answer:

Build a global action to create Contacts

Explanation:

Based on the information given the mobile solution that an app builder should recommend should be GLOBAL ACTION because global action enables new contact to be created quickly ,Global actions also enables the creation or update of records as well sending email, all without leaving the page the person is working on which is why GLOBAL ACTION is often recommended because it saves time.

6 0
4 years ago
Edhesive 4.2 question 2 answers
Citrus2011 [14]

Answer:

total=0

pet=input("what pet do you have? ")

while pet!= "rock":

   total=total+1

   print("you have a "+pet+" with a total of "+ str(total)+ " pet(s)")

   pet=input("What pet do you have? ")

Explanation: Just copy and paste above again just copy and paste this will get you a 100 percent i made another account just to give yall edhesive answers if yall need help with any edhesive just comment below

7 0
3 years ago
Write some general rules used while chatting​
Tpy6a [65]

Answer:

Well,

Explanation:

Well, this topic is a very broad one and I'm not exactly sure what kind of information you' like provided, but I got a few ideas in mind.

While chatting online, a big letdown for most people is if you curse and especially if you do it excsessivley. Doing so will make you seem toxic and most people would just try to avoid you.

Talking about toxicity, being a toxic person online is petty and quite pathetic. Gloating and raising your ego won't make you any more of a liekable person online, or even in the real world.

Last but not least, another general rule of online chatting is to make sure you know who you're talking too. Talking to strangers online can be very dangerous, in some cases leading to things like pedophilia etc.

3 0
3 years ago
Emerging technology becomes _____ when it becomes a part of everyday life. obsolete useless current necessary
ss7ja [257]

Answer:

Necessary

Explanation:

It makes the most sense. Have a great day ad sorry if this is wrong!

4 0
3 years ago
What happens when the computer is thrashing? quizzlet?
lutik1710 [3]
When computers need to use more memory than have RAM, they'll swap out pages of memory to their drive. When they need those memory pages, they'll swap out others and swap in the needed ones. If a computer needs enough additionall memory, it can get so busy swapping that it doesn't have any (or very little) time to do any useful work. That is called thrashing.

Unix calls swapping swapping. Windows calls it paging, probably because of the memory pages. Memory pages are 4096 (4KB) sections of memory.

Unix drives are usually partitioned with a swap partition, and swap files can be made in the filesystem. Windows just has pagefiles[s].
5 0
4 years ago
Other questions:
  • A. Create a console-based application named Desks that computes the price of a desk and whose Main() method calls the following
    13·1 answer
  • we studied FIFO, Priority, Round Robin (RR), and Weighted Fair Queueing (WFQ) packet scheduling disciplines. Which of these queu
    12·1 answer
  • In the following code, what is the first line that introduces a memory leak into the program?
    6·1 answer
  • What is the definition of “potential energy”?
    6·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    12·2 answers
  • T.L.E
    6·1 answer
  • Match the term to the correct definition.
    6·1 answer
  • What is another term for additive manufacturing
    7·1 answer
  • Tyler is feeling overwhelmed by the programming assignment from his supervisor and wants to break the task down into smaller, mo
    5·2 answers
  • Need help with my cs110​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!