Why we are using malloc,calloc functions ?without using this functions also memory allocated right? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why we are using malloc,calloc functions ?without using this functions also memory allocated right?

C

30th Aug 2021, 12:53 PM
511 sathish Chinnolla
511 sathish Chinnolla - avatar
1 Antwort
+ 1
There will come a time when we will need to use dynamic memory allocation. It's because storing huge amount of data in stack is a bad idea. Also, malloc() and calloc() returns pointer, created in heap, which is transferable (between functions), while stack memory is locally scoped, and will be destroyed as the function ends. https://www.sololearn.com/learn/C/2947/?ref=app
30th Aug 2021, 1:12 PM
Ipang