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
Many programmers think object-oriented programming is a superior approach to procedural programming. Others think it adds a leve
fgiga [73]

I agree with the programmers who think object-oriented programming is a superior approach to procedural programming.

<h3>Why is OOP better than procedural programming?</h3>

In terms of Security, Object-oriented programming is said to have more of a secure based than procedural programming, due to the level of abstraction or that is due to data hiding property.

Note that  It hinders the access of data to any member functions of the same class and one cannot see a thing like that such as data hiding in the procedural programming framework.

Learn more about object-oriented programming  from

brainly.com/question/12342989

#SPJ1

4 0
1 year ago
True or False? Most operating systems allow the user to specify a set of paths that are searched in a specific order to help res
inessss [21]

Answer:

The correct answer to the following question will be "True".

Explanation:

The "kernel" as shown at the core of your OS would be the central machine program. The program facilitates the essential functions of a computer processor, including coordinating activities, executing programs, and managing devices. This allows users to define a series of directions to try to resolve the connections to running program files in an order of preference.

So, the given statement is true.

4 0
3 years ago
: Each individual data items of record is called a
musickatia [10]
Each individual data items of record is called field (letter A).
The client may communicate with Proxy server to use a protocol to proxy the communication between the client and the DBMS. Proxy servers lets you hide your real Ip address and replaces it with a new IP obtained from proxy server sites.

6 0
3 years ago
Collaborative filtering is
vazorg [7]

Answer:

A: used by ISP's to filter out email SPAM

C: a way to help an individual focus on best choices when deciding what to watch or buy.

Explanation:

Collaborative filtering uses a community-based approach to filter spam. It works by collecting numerous email users from around the world. By doing this, it becomes possible for users to flag emails that are spam and those that are legitimate.

Also Collaborative Filtering is one of the most efficient techniques for building a system that can help a user when it comes to recommending best choices based on information from a large number of users.

4 0
3 years ago
How long does food remain in the small intestine?
kow [346]

About six to eight hours

7 0
3 years ago
Other questions:
  • Suppose you have an int variable called number. What Java expression produces the second-to-last digit of the number (the 10s pl
    13·1 answer
  • Which protocols are TCP/IP application layer protocols? (choose all that apply)
    5·2 answers
  • What type of social engineering attack uses email to direct you to their their website where they claim you need to update/valid
    6·2 answers
  • Is backing up computer files done on the hard drive?
    14·2 answers
  • Select the correct answer.
    10·1 answer
  • What is the output?
    5·1 answer
  • List 10 examples of computer ethics<br>(please give even 1 if you can, I need it urgently) ​
    10·1 answer
  • What defines the scope of a project?
    5·1 answer
  • Which very high-speed fiber network was already in place and being used for wide area networking (wan) transmissions, before the
    15·1 answer
  • You have been working as a junior data analyst at Bowling Green Business Intelligence for nearly a year. Your supervisor, Kate,
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!