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
What are the importance of Help and Support feature of Windows​
Tema [17]

Answer:

Explanation:

Start Menu Returns. It's what Windows 8 detractors have been clamoring for, and Microsoft has finally brought back the Start Menu. ...

Cortana on Desktop. Being lazy just got a lot easier. ...

Xbox App. ...

Project Spartan Browser. ...

Improved Multitasking. ...

Universal Apps. ...

Office Apps Get Touch Support. ...

Continuum.

7 0
2 years ago
Using a windows computer, to expand a branch of the folder tree you would _____.
s344n2d4d5 [400]
A folder can include everything from documents and music, to applications [like Word or Excel or your favorite browser]. But computer folders can also contain other folders, lots of them, and those sub-folders can contain folders of their own. This is the called folder tree. The trunk of the tree is the Desktop. Then there are several folders like Recycle Bin, Control Panel,..The most important branch is the one called ‘Libraries’. Here are the Photos, Music, Videos,...
<span>Using a windows computer, to expand a branch of the folder tree you would right click </span>beside various folders and drives to expand the folder tree.

8 0
3 years ago
An application programming interface (API) is ________. Select one: A. the code to interface between an application and RAM B. t
Olegator [25]

Answer:

An application programming interface (API) is the code the CPU recognizes to perform a procedure in an application.

Explanation:

An application programming interface (API) is the code the CPU recognizes to perform a procedure in an application. API allows an application to communicate with another application, or an operating system, database, network, etc.

An Application Programming Interface (API) creates a consideration for a problem and specifies how clients should interact with software components that implement a solution to that problem.

More recently, API has been used to refer to a specific type of interface between a client and a server, which has been described as a “contract” between both - such that if the client makes a request in a specific format, it will always get a response in a specific format or initiate a defined action.This is a specialized form of API, defined as a Web API.

3 0
2 years ago
A person you respect who offers you advice and assistance is known as a(n) _____.
Archy [21]
This would be a mentor-D. They role is to mentor or guide you with advice or assistance. A role model is a similar answer in that they respect you, but they might not offer advice or assistance which makes it incorrect.
7 0
3 years ago
after clicking the start button on your computer screen desktop what option would you then select to examine system components y
Len [333]
Start>hover over "Computer">right-click>Properties>shows system specs

Start>Control Panel>lets you modify network connections, change time and date, update, uninstall programs, add new hardware, etc.
7 0
2 years ago
Other questions:
  • Write a program to input money in cents from user, example 12745 and display the one dollar bills and the cents. Submit source c
    12·1 answer
  • What is a good way to minimize technical problems with your computer
    10·1 answer
  • To save and store data separate from a computer, it helps to have an
    15·2 answers
  • A thin red border indicates the active cell. (True or False)
    12·1 answer
  • The design of a blog refers to:
    10·1 answer
  • My sister put my phone in the microwave and I'm pretty sure the battery blew up. I'm too scared to open the microwave. What do I
    11·1 answer
  • Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reord
    14·1 answer
  • HELP
    11·1 answer
  • Describe the major elements and issues with system prototyping​
    7·1 answer
  • The layer of the ISO/OSI responsible for source to destination delivery.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!