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
Java can be procedural or object-oriented when it comes to programming. What is the difference between procedural and OOP?​
Helen [10]

Answer:

Procedural Programming => Functions

Object-Oriented Programming => Classes

Explanation:

Procedural programming is essentially what it sounds like – it's a series of procedures that the computer executes out. A procedure is essentially a function built of different steps that you the coder have grouped as such.

Object-Oriented Programming is all about objects. Objects contain data in the form of attributes, and functions in the form of methods. The most popular Object-Oriented Programming languages are class based, meaning that each object is an instance of a class (the class being a template).

Hope that helps! And you can always research more online!

7 0
3 years ago
Explain the need for data structures when developing software.
Sergio [31]

Solution:

It is  important because, it has to do operation on so without, data structures and algorithms.

It performs these operation:  

 1)Take an input

2) Process it  

3) Give back the output.

The input can be in any form, for ex while searching for directions on google maps,  the starting point and the destination as input to google maps, while logging in to any social sites, We have to give our email and password as input and so on.

Similarly, in the third step, the computer application gives us output in some form or the other.

To make this process efficient, we need to optimize all the three steps.

4 0
3 years ago
The exploitation of a buffer-overrun vulnerability in an application will MOST likely lead to:_________
SashulF [63]

Answer:

A. Arbitrary code execution

Explanation:

A buffer-overrun, also known as buffer overflow occurs when a programmer makes an error during coding, which could make his system easily susceptible to attacks from a hacker. The root cause of this problem is an overflow of data in a buffer, and programs that are written in C and C+ + are more likely to be affected by this problem.  When a buffer-overrun occurs, it would most likely lead to arbitrary code execution.

Arbitrary code execution is an uncontrolled and unrestricted coding by the attacker which alters the original coding. The attacker could input more information into the coding, which alters the original information and which would make the application porous and accessible by just anyone. It is important that programmers run regular tests on their programs, so as to detect any coding errors.

8 0
3 years ago
Assignment 1: silly sentences edhesive
Genrish500 [490]

Answer:

print("Let's play Silly Sentences!")

print(" ")

name=input("Enter a name: ")

adj1=input("Enter an adjective: ")

adj2=input("Enter an adjective: ")

adv=input("Enter an adverb: ")

fd1=input("Enter a food: ")

fd2=input("Enter another food: ")

noun=input("Enter a noun: ")

place=input("Enter a place: ")

verb=input("Enter a verb: ")

print(" ")

print(name + " was planning a dream vacation to " + place + ".")

print(name + " was especially looking forward to trying the local \ncuisine, including " + adj1 + " " + fd1 + " and " + fd2 + ".")

print(" ")

print(name + " will have to practice the language " + adv + " to \nmake it easier to " + verb + " with people.")

print(" ")

print(name + " has a long list of sights to see, including the\n" + noun + " museum and the " + adj2 + " park.")

Explanation:

Got it right. Might be a longer version, but it worked for me.

6 0
2 years ago
Audra is creating a training document and would like to include an image that she sees on her screen that she has marked up for
kupik [55]

Answer:

the first and last one

Explanation:

give me brainilest

4 0
3 years ago
Read 2 more answers
Other questions:
  • The term composite would be used to describe an image that was altered by the Crop tool.
    15·1 answer
  • What is wearable technology? Provide at least one example
    13·2 answers
  • 4. An outline is most like which of the following? (1 point)
    14·1 answer
  • The addElement operation for the linked implementation must determine the parent of the next node to be inserted. Why?
    5·1 answer
  • _____ is defined as an attraction for a source based on a resemblance between the source and receiver of a message.
    15·1 answer
  • Kevin needs to get his data from a database into a text file to send to another group. He needs to _____.
    12·2 answers
  • What would be an ideal scenario for using edge computing solutions?
    10·1 answer
  • A(n) __________ structure is a structure that causes a statement or a set of statements to execute repeatedly.
    13·1 answer
  • 2.
    13·1 answer
  • Discuss new concepts that you have learned about Cisco Devices and how they will be helpful in the workplace.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!