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
Lesechka [4]
3 years ago
8

In this lab, you will implement your own dynamic memory allocator (heap manager) in C. We will use the simple (but somewhat inef

ficient) free list system of heap allocation. You will demonstrate how to use your allocator to allocate dynamic memory for a variety of C types.
Computers and Technology
1 answer:
Vera_Pavlovna [14]3 years ago
5 0

Answer:

#include <stdio.h>

#include <stdlib.h>

 

int main()

{

   int *iVar;

   char *cVar;

   float *fVar;

     

   /*allocating memory dynamically*/

     

   iVar=(int*)malloc(1*sizeof(int));

   cVar=(char*)malloc(1*sizeof(char));

   fVar=(float*)malloc(1*sizeof(float));

     

   printf("Enter integer value: ");

   scanf("%d",iVar);

     

   printf("Enter character value: ");

   scanf(" %c",cVar);

     

   printf("Enter float value: ");

   scanf("%f",fVar);

     

   printf("Inputted value are: %d, %c, %.2f\n",*iVar,*cVar,*fVar);

     

   /*free allocated memory*/

   free(iVar);

   free(cVar);

   free(fVar);

 

   return 0;

}

You might be interested in
You have to communicate a signal in a language that has 3 symbols A, B and C. The probability of observing A is 50% while that o
Vlada [557]

Answer:

Huffman code is use for encoding the language. The entropy when calculated is 1.5.

Explanation:

Using Huffman Coding scheme to encode:

The huffman coding scheme is described in the attachment.

To find entropy; we use the formula given below:

H = ∑p log_{2}  \frac{1}{p}

where H = Entropy and p = probability

p(A) = 50% = 1/2

p(B) = 25% = 1/4

p(C) = 25% = 1/4

H = \frac{1}{2} log_{2} 2 + \frac{1}{4}  log_{2} 4+ \frac{1}{4} log_{2}4\\H = \frac{1}{2}(1) + \frac{1}{4}(2) + \frac{1}{4}(2)\\H = \frac{1}{2} + \frac{2}{4} + \frac{2}{4}\\H = \frac{1}{2} + \frac{1}{2} + \frac{1}{2}\\H = \frac{3}{2}\\H = 1.5

Download pdf
7 0
3 years ago
What is one reason why a business may want to move entirely online?
andrezito [222]

Answer:

To focus on global market

Explanation:

Hope this helps! :)

3 0
3 years ago
“When using a public computer for browsing the Internet, try to use for 1.________ transactions. Also, use 2.__________ browsing
Tamiku [17]

option 2 is c

option 1is B

3 0
3 years ago
Read 2 more answers
This type of server spools documents and puts them in a queue.
Paraphin [41]

Print is the type of server that spools documents and puts them in a queue. Whenever you are printing multiple documents, it is the standard operation of the printer to prioritize those documents that came first and add to the queue the other documents waiting for printing.

4 0
3 years ago
All of the following are examples of being computer literate, EXCEPT ________. knowing how to use the web efficiently knowing ho
Tamiku [17]

Answer:knowing how to build and program computers.

Explanation:

8 0
3 years ago
Other questions:
  • Under extreme programming, ________ and ________ are intimately related parts of the same process
    13·2 answers
  • BRAINLYEST IF CORRECT!!! What is the special feature of the View Side by Side command?
    6·2 answers
  • Jerry has received an email on his company’s email system. The email is in regard to a new update the company plans to implement
    9·1 answer
  • Suppose L is a LIST and p, q, and r are positions. As a function of n, the length of list L, determine how many times the functi
    8·1 answer
  • Describe the components of a CPU--the CU, ALU, and Cache--and explain how they interact to make the CPU function.
    13·1 answer
  • IN C++ PLEASE!!!! Define a function FilterStr() that takes a string parameter and returns "Good" if the character at index 4 in
    7·1 answer
  • modified true or false analyze each statement then write technical the statement is true the statement is false underline the wo
    6·1 answer
  • In one to two sentences, describe how you would add a new slide to your presentation.
    11·2 answers
  • Why it is not recommended to add sound effect on slide transition? Write at least two reasons.​
    6·1 answer
  • In this exercise, you are asking the user to set a alpha numeric password for any website. Put some conditions.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!