malloc and free Functions in C Programming Language Video Tutorial

preview_player
Показать описание
In this C programming language video tutorial / lecture for beginners video series, you will learn about the malloc() and free() functions used for dynamic memory allocation in detail with example.

you will learn the syntax of malloc function and free functions, what are the parameters required for the malloc and free functions, how malloc function allocates the bytes of memory from the heap,how free function frees the allocated memory.

You will learn how to create the pointer and allocate the memory dynamically for integers,float and character datatype, and also learn how to allocate the memory dynamically depending on the user input to store a string in detail with an example.

Learn Programming in HINDI at our youtube channel

Catch us on Social Media
Рекомендации по теме
Комментарии
Автор

Thank you for showing us this in C. Well-explained video.

ifoundthewords
Автор

These videos were of great help...all the concepts are explained in a very crisp and explicit way...thank you..:)

pratibhagoenka
Автор

sir if input more than size its prints normally whatever i give input then what is the role of lenghth

Hideto_
Автор

Great explaination...
one doubt puts function = print function?

RonakRawatBusiness
Автор

hello ur way of teaching is awesum sir well in this tutorial u said that malloc() returns address of first byte of alloacated memory but u used void there how it gonna returns den?

saipravallikapolukonda
Автор

While taking input of string from the user and printing it why did you use gets(p) and puts(p)... You should be using gets(*p) and puts(*p) right?..

BoxingTubeBLR
Автор

Hi Anil! I tried it without casting and it worked, do we really need to cast malloc functions? Is it good practice to cast malloc or not?

geloppy
Автор

i am getting output even the string entered is greater than the string length of the string .Then what is need of length over there??

dhaminipasam
Автор

Hello anil sir,

when i do this program i find an error for malloc() and free(). It shows that they should have prototype... so what are the solution for that..

maulinshah
Автор

pointer variable can only hold the address .right?
i dont understand ( *p=20;),
please anyone explain

I_am_pradeep
Автор

I can't understand one thing that (int*)malloc(sizeof (int)); returns address. But we are using (int*) shouldn't it returns value to p instead of address . Or (int*) has no effect on (int*)malloc(sizeof (int));.
Please some body help i'm really confused.

aakash
Автор

What is the exactly role of fflush(stdin) function in this program?

bipros
Автор

can anyone explain me clearly why is fflush(stdin) is used or any thing is appreciated?

devreddy
Автор

Am getting this Error.
warning: implicit declaration of function ‘gets’; did you mean ‘fgets’?
gets(p);
^~~~
fgets

flomtechsolutions
Автор

Firstly, thank you for awesome tutorials. There is something that I could not understand. If you help, I will be thankful.

I want 3 bytes from memory and then equal that to an int. Each integer variable was 4 bytes however the memory which I set it as 3 bytes can be an integer. In theory, it must not work, must it?

int *p;
p=(int *)malloc(3);
*p=10;
printf("%d", *p);

It works but it must not. Can you explain it?

meruems
Автор

why are u using pointer here
main()
{
int *p
p=(int *)mallocof(sizeof(int));
y are u using pointer *p here y we cannot use ordinary variable;

n.rukkumani
Автор

Subtitles please, ALWAYS USE SUBTITLES... please ;-( ;-( ;-( ;-(

zigallodee
Автор

Anil, i wanted to ask you a question about pointers,
 int *x = 15;
 printf("%d", *x);
why does it crash?
and why when i am doing that it doesnt?
 int *x = 15;
 printf("%d", x);

what extacly does x represent without the * operator?

FacebookIL
join shbcf.ru