C_133 Dynamic Memory Allocation using malloc() | C Language Tutorials
Vložit
- čas přidán 13. 08. 2024
- C complete playlist: • Programming in C
Use my code jkl10 to get 10% off on GATE subscription
GATE Subscription- unacademy.com/...
Evolve for GATE 2023 (CS & IT) - Batch unacademy.com/...
Spark for GATE 2023 (CS & IT) - Batch D (English)- unacademy.com/...
Ascend for GATE 2024 (CS & IT) - Batch G- unacademy.com/...
Connect & Contact Me:
Vlogging Channel Link: bit.ly/354n7C7
Facebook: / jennys-lectures-csit-n...
Quora: www.quora.com/...
Instagram: / jayantikhatrilamba
Twitter: / khatrijenny
See Complete Playlists:
Placement Series: • Placements Series
Data Structures and Algorithms: https: • Data Structures and Al...
Design and Analysis of Algorithms(DAA): • Design and Analysis of...
Dynamic Programming: • Dynamic Programming
Operating Systems: // • Operating Systems
DBMS: • DBMS (Database Managem...
#Cprogrammingtutorials
#DynamicMemoryAllocationinC
#mallocfunctioninC
#Jennyslectures
In static memory allocation you have a glass full of water and in dynamic memory allocation you have an empty glass and a jug and you can take as per your need.
Nice bro
Sahi hai !
Thanks bhai
Exactly 💯
How bro felt after giving this beautiful example 😃😀
1. Static Memory Allocation (Toy Shelves):
Imagine you own a toy store, and you have a fixed set of shelves with five slots. Each slot can hold a different toy. You decide in advance which toys will go into each slot. Once the toys are placed, you cannot change the shelves' structure, and the toys in those slots are fixed. This is similar to static memory allocation.
2. Dynamic Memory Allocation (Toy Store with Adjustable Shelves):
Now, imagine you own a toy store, but this time you have the ability to add or remove shelves as needed. You start with an empty store and add shelves to accommodate toys as customers come in. If a customer leaves, you can remove the shelf to free up space. This represents dynamic memory allocation.
Ma'am, your ways of explaining concepts are too good, I learnt C and C++ at least 2 decades ago. Wish we had someone like you to teach us, would have aced it for sure.
Thank you so much for your support.
Real life example:-
Static memory allocation:- having wallet so that we can pay currency notes whenever we need , for that we need to keep as much money inside wallet as expected no matter it'll be used or not.
Dynamic memory allocation :- rather than having a wallet to pay money, we can keep Google pay or Paytm on our mobile so that we can pay money as per the need there will be no tention to keep currency notes
Hope u guys can relate with it😅😅
not that appropriate example according to me
@@lokesh6828 sad to know
My bad😢😢
@@AnuragRawat01 I have modified you example, maybe that is more appropriate
@@AnuragRawat01
The real life example can be
Static memory allocation : Having Rs 10000 from which you can purchase anything but you cannot resell it.
dynamic memory allocation: having Rs 100000 from which you can rent anything around you and when to return the rented item, you will get full refund and you can use it again and again.
Mam I love ur lecture due to u I can write program and also understand program
Ma'am I am from northeast! Currently doing my BSC in Cs ! Your videos make programming even more better and easier! ✌️❤️❤️❤️
me also in same course
I'm watching another C course besides Jenny, both are amazing, but everytime I get confused there I come here and find the information missing that I was asking for in the other course. Anyway, no course is able to cover every aspect of a subject, so they are complementary, and Jenny is always great on explaning, thank you so much!
Which other one did you watch? (If you don't mind me asking)
@@erinsumner1550 Portpholio Courses
mam please upload a video on malloc function using structure
S mam pls
I am also RGUKT
Hlo
Pavani
Please mam
Hi Jenny love your videos! I would be very interested in a video that further explains how this magic box called malloc works behind the scenes. How does it find memory to give you? How expensive is it to call it and what are some good practices? Does memory fragmentation affect it at all?
Ma'am plz upload the vedio. That how can we use maloc( ) ,in structure 🙏🙏🙏
It's my heartly request ma'am
Yes
Perfectly explained everything, an absolute perfection you have in your videos mam.
May you please give an example of malloc() for structure as you suggested in this video? Thank you very much!
Madam please provide video lecture on dynamically allocated structure concept
what ever you are teaching is very useful and informative thanks for the concern.
reacently watched "c" videos way of teaching excellant lot of knowledge is their in your videos ☺, as early as possible can you start java.thank you mam,yours loving student😘
Extraordinary teaching ma'am 🔥🔥🔥
I didn't understand chapati concept madam, because I don't know hindi. But I understand what you are going to teach.😉😉
a[n] , where 'n' is the number of integer data that user wanted to add. Now no memory is wasted right??. Is it now static??
Thank u mam for doing vedios on c it helping a lot i recommend so many students on my college and you make it c as easy😊😊
I like your dynamic chapati allocation example....can relate to it
Whaooo, cannot stop watching your lecture! Thanks very much ☺
Thank you , your videos are amazing ....I am loving C
Thank you very much! Such great videos!
Thank you so much man🙏🤍
Please Mam make a video
Display the names in alphabetical order🤍
Though your English is a bit hard to listen to, I get familiar with it while turning on the caption. Actually, I'm learning another paid course, but I must watch your lessons because they're very easy to understand, they're helping me to figure out what is really under the hood.
The video will be started at 2:29 you can thank me later
Very good explanation 👍
Hello, mam can you make a video on matrix chain multiplication, regarding dynamic programming please!!
With regards... From me
Thank you 😊
Your videos are really helpful
Amazing teaching 👏 mamm
Mam u r looking good in this red colour
Mam here I have a doubt,we can also reduce the memory waste using"" variable length array concept ""mam.then why we want to use malloc for reduce memory waste
Mam I liked your teaching way as well as your hair style 🥰
Please Mam, as soon as you speak your language, we lose your explanations.
Your explanations are so valuable that we don't want to miss a word of what you say.
Remember that people follow you all over the world; United States, Europe, Africa..
I'm really sorry for the inconvenience, a temporary soluiion could be, pls mention the time over here and ig someone kind enough could explain the part spoken in Hindi Language....
Amazing Explanation 🍓🌚🙊
even sandeep jain couldnt make me understand dma...but you did it ma'am...
After free(ptr) when I printing the values the values are being printed, But after free(ptr) the values should not be printed na... Why Is this happening May I know where did I did the mistake...
Huge fun and a follower you have a mentor in c language i just get trouble in understanding your language when you shift from English to ..... leaving me hanging . But you are be best
thanks mam u looking superb mam
If we want to creat a pointer normally then we can write int*ptr=&any variable this things int* ptr=variable
Just a genuine question, do you take personal tutions of students, I do understand your course, but sometimes I've got program questions which are difficult to understand 😅
Mam your teaching style is as beautiful as you 🙏🙏🙏
Why can't we use
Int n;
Scanf("%d",&n);
Int a[n]
It is also working
We are giving input at runtime
Thnak you for the explicit exposition
You are fantastic.
At 22:18 I had some confusions. I thing you spoke your dialect. 👍
You can Google it brother
she was explaning the logic of Dynamic memory allocation and its importance of a their food Chappathi.
if you request your friend to bring you chappathi delivered @ your home since you are not sure how much hunger you are in, your friend might possiblly bring more number of chappathi (for eg:) 5 but you may eat just 2 or 3 and rest is a waste which is a example of Static memory.
Where as if you go to a canteen or a restraunt and get the food according to your need and there is no wastage which is the example of Dynamic memory.
Tq mam for u work for us
I like you, your teaching style.
It feels very lovely when i listen uh speaking hindi🥰🥰🥰
Good explanation
Superrr sis...
Thank you so much lovely ma'am ❤😊
You are beauty with brain 😊😊😊😊😍
madam great explanation
Good evening mam🙏🙏🙏💐💞❤
god level teaching
I have just entered values with Upto n+5 (in for loop, like i
Please reply still how many videos are there to complete c programming language
Please start python tooo please
I'm die hard fan of you ❤️
Love you from NEPAL 😙
Love from Andhra Pradesh 😊😊
You are so good ma'am 🤩
You are Gorgeous, One of Gods great creations.♥️
In that y we are using int* at first of malloc (time:10:46) y we can't use int alone
Which one is better
p is pointer and i is in loop
Scanf(“%d”,&p[i])
Or
Scanf(“%d”,(p+i))
I think the 1st one....its more comfortable... Bt is it correct in this case?
amazing lecture mam
I became fan of your beauty ❣️
Super timeing edi matram
Mam op teaching i like ur lecture
Nice explanation..
Love teaching 🎈❤️
Engineering Teaching madams are good.....
But we can achieve the same thing by the below method also right?
int n;
scanf("%d",&n);
int arr[n];
Beautiful
Thank you mam for this video
can you please explain in program of malloc how the pointer returns null
please????
great explanation
Mam i have a doubt
We can do that with static memory allocation too mam. I observed that here after given the input value of n we can store that n number of values
Why dont we do this like this using static memory allocation :
#include
void main()
{
int n;
printf("Enter the no. Of values do u want to store
");
scanf("%d",&n)
int arr[n];
for(int i = 0;i
we can do it, that's not the point, we are learning dynamic memory allocation not static.
@Shuaib jawed please listen him... He s asking relevant question of this DMA... Same problem I am facing as a learner .. mam please response for this comment... I have posted the same issue in comment section... Pls help us to come out of this issue...
Prakash reddy, u found any solution ??.. pls reply
@@aswinkumarraj5054 bro the way u are doing is just normal static way, it's not dynamic
Yes... The above program was static... But even DMA getting the same result... That s wat I am asking bro
I have a question
Why we didn't declared the malloc function as
"void* malloc(size_t size);"
The real life example can be
Static memory allocation : Having Rs 10000 from which you can purchase anything but you cannot resell it.
dynamic memory allocation: having Rs 100000 from which you can rent anything around you and when to return the rented item, you will get full refund and you can use it again and again.
22:13 your real life example was spoken in Hindi.. I don't understand Hindi 😕
He is telling that if you are in a hostel and you tell your friend to go into mess and bring 4 to 5 chapatis but you and your friend don't know how how many chapati see you will eat so if he will bring 4 to 5 chabathis and you have eaten only do then rest three are waste so like this is example
@@disciplined469 ohh thanks so much.
Static memory : Live cricket match (we can't watch the match before or after)
Dynamic memory:We will watch the match Highlights whenever you want
Data structure ka practice paper laiye
i always want to learn about dma concept but dint understand before much , love the way she teaches and it clear all my memory concepts, thank you so much for the video, keep up the good work ma'am
Happy to hear that!
@@JennyslecturesCSIT mam I want to learn c++ language and I covered till DMA so will it be easy to learn or it is entirely different
THANKS 👍👍
ma'am your lookning gorgeous and your lecture too
why should we have to type cast, when generic pointer can take any type of pointer right?
Success comes from having dreams that are bigger than your fears.
Bobby Unser
I love you ❤️😂
This is my first class
Mam after allocating 8 bytes if we need more memory like we need to expand that existing memory block then how we can do that
In "programming in c" playlist, this is the first video with 1080p quality. But of no use because ma'am looks prettier even in 144p quality😅
Beauty with brain❤️
Frankly speaking I love you mam❤️😅
Mam but pointer variable is used to store only address but why are you using point er variable to store DMA
mam please make python videos
Mam in same program char pointer i am using instead of using int.
But the problem is when i give value of n =4
So i will be able enter two element
When i give eight as value of n then i will able to enter 4 element.
Why is it so?
Why i can't enter element equal to n
Please mam Give respons as soon as posible
Mam, You are looking very beautiful in this video, Gorgeous☺
He Jennie kya lag rahi ho yaar ye red colour ka shout me to gajab lag rahi hai, aapki lecture se jyada mujhe aap pasand ho, i love 💕😘 you
Mam can you upload a video for malloc using structure
Mam ur looking very gorgeous 😍❤️
Thank You Mam.
thank you very much. but please dont use Hindi inside of a video 😅😅.
Why bro?
Chapati example are very 🐎😅😅good chapati
pls can you also do a video on big O notation
Mam I am not interested computer but i am always interested you
Mam please do live lectures
Good morning madam