Define memory allocation functions, Computer Engineering

Assignment Help:

The various memory allocation functions are described below:

(i) malloc( ): It is a memory allocation function that assigns requested size of bytes and returns a pointer to the first byte of the allocated space. The malloc function returns a pointer of type void so we can allocate it to any type of pointer.

(ii) calloc( ): It is another memory allocation function that assigns space for an array of elements, initializes them to zero and then returns a pointer to the memory. This function is normally used for request memory space at run time. Whereas malloc allocates a single block of storage space, calloc allocates multiple block of storage, each of the similar size, and then sets all bytes to zero

(iii) realloc( ): realloc is a memory allocation function that changes the size of previously allocated space. Sometime it may happen that the allocated memory space is larger than what is needed or it is less than what is needed. In both cases, we can change the memory size already allocated with the help of the realloc function called as reallocation of memory

 


Related Discussions:- Define memory allocation functions

Describe clusters in cellular systems, Question: a) With the help of a...

Question: a) With the help of a diagram, describe clusters in cellular systems. b) Describe the role of the following components in the GSM architecture Radio Sub-Sy

Why are binary, Q. Why are binary, octal and hexadecimal used for computer ...

Q. Why are binary, octal and hexadecimal used for computer applications? Q. Perform the following: (189.3) 10 = (?) 2

What is game playing ai, This covers a number of game playing methods, nota...

This covers a number of game playing methods, notably checkers and backgammon because so much good research has been completed on these problems and because so many different metho

Generate the output that the temperature entered is outside , Write a pseud...

Write a pseudocode for a program that reads a temperature as a whole number from a user and outputs a "probable" season (winter, sprint, summer, or fall) depending on the temperatu

A digital signature, A digital signature is   encrypting information

A digital signature is   encrypting information

The 2''s complement of the decimal number, What is the 2's complement of th...

What is the 2's complement of the number 1101101 ? Ans. 0010011 is the 2's complement of the number 1101101. As 1's complement of the number 1101101 is 0010010 and 2's comple

What is python?, Python is an interpreter, interactive, object-oriented pro...

Python is an interpreter, interactive, object-oriented programming language. It is frequently compared to Tcl, P e r l, Scheme or Java. Python combines remarkable power with v

What are event and its types, What are event and its types? An event is...

What are event and its types? An event is an occurrence at a point in time, like user depresses left button. Event happens instantaneously with regard to time scale. Type

What is the purpose of iop, What is the purpose of IOP. The purpose of ...

What is the purpose of IOP. The purpose of IOP is to given an independent path way for transfer of information among external and internal memory.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd