answersLogoWhite

0

How to allocate memory efficiently in C?

User Avatar

Donato White

Lvl 10
4y ago

Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: How to allocate memory efficiently in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are new and delete operators in c plus plus?

New and Delete are the memory management operators in c++,like c language we use malloc() and calloc() functions to allocate memory and free() functiong to release the memory similarily we use new to allocate memory in C++ and Delete to release the allocated memory....


When memory allocate to Static data in c?

Compilation time.


What will happen if you allocate memory using new and free it using free or allocate sing calloc and free it using delete?

The C++ new uses malloc internally to allocate memory and the C++ delete uses free internally to revoke memory. However, they are not interchangeable and so memory allocated with new MUST be revoked with delete. If you mix them up, you will have a memory leak! Haya.


What is the memory management operator in c plus plus?

There is no memory management operator in C++ -- it is an unmanaged language. You use the C++ new operator to allocate memory, and use the C++ delete operator to release previously allocated memory.


What is the operator is used to allocate the memory in c plus plus?

calloc operator,malloc operator


How can you allocate memory dynamically in c?

char* new_string; // could be any type new_string = (char*) malloc (5120); // allocate memory - typecast is necessary if (new_string == NULL) ... memory exception ... ... use the data ... free (new_string); // release memory when done


How would you define variable in c?

variable is a name that allocates the memory space where you store some data Hardly. Names do not allocate memory space *sigh*


How you allocate the memory in java?

In Java we need not allocate memory manually. The JVM would take care of allocating as much memory that your objects would require automatically.


Why use new and delete operator overloading in c plus plus?

one reason to use new and delete operator overloading in c++ is when you are using your own memory manager code. when the user of your code calls the new keywork, your memory manager code can allocate memory.


What are the different function used for dynamic memory allocation?

alloc :- to allocate memory. calloc :- to free the memory.


How does C Plus Plus handle dynamic memory allocation?

To allocate memory in C++ you use the new operator. To release the memory, you use the delete operator.double *myArray = new float [1000];//check and usedelete [] myArray;myClass *myClassInstance = new myClass;//check and usedelete myClassInstance;


What is Memory management in ms dos?

MS-DOS does not have built-in memory management.