malloc in c | dynamic memory allocation | by dubebox #shorts

preview_player
Показать описание
dynamic memory allocation - malloc in c

The name malloc stands for memory allocation.

The malloc function reserves a block of memory of the specified number of bytes. And, it returns a pointer of void type , which can be casted into pointers of any form.

Example -

I have allocated memory dynamically with the help of malloc for 100 blocks of memory.
Each block is having size of 4 bytes. Hence , total of 400 bytes of memory would be allocated.
And lastly, pointer typecast is required of integer type.

#malloc #shorts #bydubebox #cprogramming
Рекомендации по теме
Комментарии
Автор

Please mention int *ptr instead of int ptr.... students think that no need to declare pointer variable.

kakajsbdhdh
Автор

bro just explained a 15 min video in seconds.

starboy_bala