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

Retina - biometric computer security systems, Retina - Biometric Computer S...

Retina - Biometric Computer Security Systems The next security technology that explained in this report is retina security technology which is very famous in a lot of spy movi

How to set cell properties in dreamweaver, Q. How to Set Cell Properties in...

Q. How to Set Cell Properties in dreamweaver? Cell height determines the height of space within a cell row. Notice the space around Compass logo. You want to remove the extra s

Neural networks as perceptrons, Neural networks as perceptrons: Howeve...

Neural networks as perceptrons: However ANNs look like this in the general case:  Considered that the w, x, y and z represent real valued weights so all the edges in t

What is core dump, Raises when accessing an unassigned memory location acce...

Raises when accessing an unassigned memory location accessing a null pointer

What are the steps involved in designing, Before getting into the design th...

Before getting into the design the designer should go by the SRS prepared by the System Analyst. The main tasks of design are Architectural Design & Detailed Design. In Arch

Explain two dimensional array, Explain two dimensional array In two dim...

Explain two dimensional array In two dimensional arrays, array is a pointer-to-pointer-to-data type.: at the first level, it points to a block of pointers, one for each row. Th

Difference between char a[] = "string", What is the difference between char...

What is the difference between char a[] = "string"; and char *p = "string";? Ans) In the first case 6 bytes are assigned to the variable a which is fixed, where as in the secon

Define the emphasis on object structure, Define the Emphasis on Object Stru...

Define the Emphasis on Object Structure Emphasis on Object Structure, not on Operation Implementation In object orientation the importance is on specifying the qualities

Interpreted language and a compiled language, Difference between an interpr...

Difference between an interpreted language and a compiled language? Ans) A compiled language is written and then run by a compiler which checks its syntax and compresses it int

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