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
Harrizon [31]
2 years ago
7

Write two statements that each use malloc to allocate an int location for each pointer. Sample output for given program:

Computers and Technology
1 answer:
Mekhanik [1.2K]2 years ago
7 0

Answer:

#include <stdio.h>

#include <stdlib.h>

int main(void) {

   int* numPtr1 = NULL;

   int* numPtr2 = NULL;

   /* Your solution goes here */

   numPtr1 = (int *) malloc(10);

   numPtr2 = (int *) malloc(20);

   *numPtr1 = 44;

   *numPtr2 = 99;

   printf("numPtr1 = %d, numPtr2 = %d\n", *numPtr1, *numPtr2);

   free(numPtr1);

   free(numPtr2);

   return 0;

}

Explanation:

The C library malloc function is used to assign memory locations (in bytes) to variables. It accepts the size parameter and returns a pointer to the specified variable location.

The two malloc statements above assign two memory locations 10 and 20 to the numPtr1 and numPtr2 integer variables respectively.

You might be interested in
Pls answer 10 points ​
AlekseyPX

Answer:

1. C

5.b

Explanation:

1. Is c because it is in the short cut key

5. Is B because it is the last choice

3 0
2 years ago
Read 2 more answers
Gina is upgrading your computer with a new processor. She installs the processor into your motherboard and adds the cooling syst
Setler [38]

Answer:

Option B is Correct.

Explanation:

Thermal paste is used in the CPU motherboard to reduce the heat.

Thermal paste is a heat observing coating that is used to make the system cool when it is heated much by working for a long time.

Thermal paste is also used in heat sink in CPU and CPU passes the air in the heat sink to make the temperature normal.

Thermal paste is very useful which installing any processor otherwise which running, the temperature will be increased in the absence of the thermal paste.

It is used to maintain the empty place between the motherboard and the processor.

7 0
3 years ago
Using Word, Maureen is writing an outline of a presentation she plans to give to her company. She will be showing a video during
svlad2 [7]
A copy and paste would be fastest and easiest. As you can pinpoint the exact location to where you want the picture to be. 
5 0
3 years ago
Read 2 more answers
Disadvantage do you think one can have if he or she does use electronic media
Dima020 [189]
- discontinuity
- dependence on the electric power
and more
6 0
3 years ago
Can someone please answer this for me ? What is data centre virtualization?
castortr0y [4]
Data center virtualization is the process of designing, developing and deploying a data center on virtualization and cloud computing technologies. It primarily enables virtualizing physical servers in a data center facility along with storage, networking and other infrastructure devices and equipment.
3 0
3 years ago
Other questions:
  • Suppose we eliminate tcp and instead rely exclusively on udp as our only transport layer protocol. ⢠how does this impact opera
    15·1 answer
  • Which of the following statements is true of intrapreneurs
    15·1 answer
  • Suppose that a system uses 32-bit memory words and its memory is built from 16 1M × 16 RAM chips. How large, in words, is the me
    11·1 answer
  • the list of available fonts in the fonts gallery may differ, depending on what fonts you have installed and the type of printer
    14·1 answer
  • The natural language convention used to represent ip addresses is called the:
    15·1 answer
  • If you have defined a class named SavingsAccount with a public static data member named numberOfAccounts, and created a SavingsA
    7·1 answer
  • Pls help now the question is very hard someone help me pls​
    6·1 answer
  • 1. Fill in the blanks:
    7·1 answer
  • How many times is the body of the loop executed?
    8·1 answer
  • Simon would have regarded with impotent fury the disturbance between the North and the South, as it left his descendants strippe
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!