Lesson 21 of 23
Dynamic Memory: malloc ಮತ್ತು free
10 min 35 XP
Size run time ನಲ್ಲಿ ಮಾತ್ರ ತಿಳಿದಾಗ malloc ಮೂಲಕ heap memory ಕೇಳಿ. ಕೆಲಸ ಮುಗಿದ ಮೇಲೆ free ಮೂಲಕ ಬಿಡುಗಡೆ ಮಾಡಿ, ಇಲ್ಲದಿದ್ದರೆ memory leak ಆಗುತ್ತದೆ.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.malloc vs calloc: calloc memory ಯನ್ನು ಸೊನ್ನೆ ಕೂಡ ಮಾಡುತ್ತದೆ; realloc ಅದರ size ಬದಲಿಸುತ್ತದೆ. Stack vs heap ಆಗಾಗ ಬರುವ interview ಪ್ರಶ್ನೆ.