What is malloc ()?


Why is it needed and how to use it?


In C / C ++, this is a function for allocating memory ( m emory allocation ).

char *str = (char*)malloc(sizeof(char) * 5);

Allocates 5 * sizeof (char) bytes of memory.
I do not quite understand what the csharp label has to do with it, as far as I know there is no such function in sharps, but if I'm wrong, then I sign in question =)

Scroll to Top