What is malloc function in C?

1 answer

Answer

1186526

2026-07-29 10:40

+ Follow

The malloc function is a function used in C/C++ and various other high-level programming languges to add memory to the heap, it is essentially a pointer

int* X = malloc(sizeof(int));

Where the parameter to malloc is the number of bytes you want to make room for. Because we are using an integral variable we want to make as much room as an integer takes.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.