Static vs Dynamic Memory Allocation in Data Structures Notes in Hindi & English : स्टैटिक बनाम डायनामिक मेमोरी आवंटन (malloc, calloc, realloc, free) और 20 महत्वपूर्ण MCQ प्रश्न (Rajasthan IT Exam)

Post a Comment

PGDCA, BCA, B-Tech, MCA, M-Tech, B.Sc computer science राजस्थान सूचना सहायक व कंप्यूटर शिक्षक विशेष नोट्स: इस अध्याय में हम Static vs Dynamic Memory Allocation in Data Structures (स्टैटिक बनाम डायनामिक मेमोरी आवंटन (malloc, calloc, realloc, free)) की संपूर्ण थ्योरी, मुख्य तकनीकी बिंदु, तुलनात्मक तालिका और विगत परीक्षाओं के पैटर्न पर आधारित 20 अति-महत्वपूर्ण बहुविकल्पीय प्रश्न (MCQs) विस्तृत हिंदी व अंग्रेजी व्याख्या सहित पढ़ेंगे।

Overview: Static memory allocation binds fixed storage sizes at compile time on the stack or data segment, whereas dynamic memory allocation reserves variable-sized blocks at runtime on the heap via <stdlib.h> functions (malloc, calloc, realloc, free). Dynamic allocation enables flexible structures like linked lists and trees, though it introduces pointer overhead, heap fragmentation, and risks of memory leaks or dangling pointers.

अध्याय सार: स्टैटिक मेमोरी आवंटन में डेटा का आकार कंपाइल-टाइम पर स्टैक या डेटा सेगमेंट में स्थायी रूप से तय हो जाता है, जबकि डायनामिक मेमोरी आवंटन रन-टाइम पर हीप (Heap) से <stdlib.h> के malloc, calloc, realloc और free द्वारा आवश्यकतानुसार मेमोरी लेता है। डायनामिक आवंटन से लिंक्ड लिस्ट व ट्री जैसी लचीली संरचनाएं बनती हैं, लेकिन इसमें पॉइंटर प्रबंधन, हीप फ्रैग्मेंटेशन, मेमोरी लीक और डैंगलिंग पॉइंटर से बचना जरूरी होता है।

Static vs Dynamic Memory Allocation in Data Structures: Detailed Notes & Architecture (स्टैटिक बनाम डायनामिक मेमोरी आवंटन (malloc, calloc, realloc, free))

1. Static Memory Allocation: Stack, Data Segment & Compile-Time Binding (स्टैटिक मेमोरी आवंटन: स्टैक, डेटा सेगमेंट व कंपाइल-टाइम बाइंडिंग)

[EN] In static allocation, variable and fixed-array sizes must be known before execution begins; global and static-duration objects live in the initialized (.data) or zero-initialized (.bss) segment while local variables reside on the LIFO call stack. Allocation and deallocation happen automatically through stack-pointer movement in O(1) time without explicit programmer cleanup. However, rigid compile-time sizing causes wasted RAM when over-estimated or buffer overflow/truncation when real runtime inputs exceed the declared capacity.

[HI] स्टैटिक आवंटन में वेरिएबल या एरे का आकार प्रोग्राम चलने से पहले ही तय होना आवश्यक है; ग्लोबल वेरिएबल डेटा सेगमेंट (.data/.bss) में तथा लोकल वेरिएबल कॉल स्टैक पर रहते हैं। स्टैक पॉइंटर के बढ़ने-घटने से मेमोरी स्वतः आवंटित व मुक्त होती है। इसकी मुख्य सीमा यह है कि रन-टाइम पर आकार घटाया या बढ़ाया नहीं जा सकता, जिससे या तो मेमोरी बर्बाद होती है या डेटा कम पड़ जाता है।

2. Dynamic Memory Allocation: Heap Segment & <stdlib.h> Primitives (डायनामिक मेमोरी आवंटन: हीप सेगमेंट व <stdlib.h> के मुख्य फंक्शन्स)

[EN] Dynamic allocation acquires memory during execution from the Heap using four standard ISO C <stdlib.h> functions: malloc(), calloc(), realloc(), and free(). All three allocator functions return a generic void* pointer pointing to the lowest byte address of the allocated block, or NULL if the OS/allocator cannot satisfy the request. Because heap blocks persist across function returns until explicitly released, programmers can pass dynamic data structures safely between stack frames.

[HI] डायनामिक आवंटन प्रोग्राम के निष्पादन (Run-time) के दौरान हीप (Heap) से मेमोरी प्राप्त करता है, जिसके लिए मानक हेडर <stdlib.h> में चार फंक्शन—malloc(), calloc(), realloc() और free()—दिए गए हैं। तीनों आवंटन फंक्शन सफलता पर void* पॉइंटर (ब्लॉक का शुरुआती पता) तथा मेमोरी न मिलने पर NULL लौटाते हैं। हीप की मेमोरी फंक्शन समाप्त होने पर स्वतः नष्ट नहीं होती, बल्कि free() चलाने तक बनी रहती है।

3. Internal Mechanics: malloc vs calloc Initialization & realloc Resizing (आंतरिक कार्यप्रणाली: malloc बनाम calloc व realloc का व्यवहार)

[EN] malloc(size_t bytes) allocates a single contiguous block of raw uninitialized bytes containing indeterminate garbage values, making it slightly faster when the caller immediately overwrites the block. Conversely, calloc(size_t count, size_t elem_size) computes count * elem_size and clears every bit to zero, preventing stale data leaks. realloc(void *ptr, size_t new_bytes) shrinks or expands a previously allocated block—potentially relocating bytes to a fresh heap region and freeing the old block—and behaves like malloc(new_bytes) if ptr is NULL.

[HI] malloc(bytes) बिना सफाई किए एक कच्चा मेमोरी ब्लॉक देता है जिसमें पहले से कचरा मान (Garbage Values) रहते हैं, इसलिए यह थोड़ा तेज होता है। इसके विपरीत calloc(n, size) कुल n*size बाइट्स लेकर हर बिट को शून्य (0) कर देता है। realloc(ptr, new_size) पुराने ब्लॉक के आकार को बदलता है और जरूरत पड़ने पर डेटा को नए स्थान पर कॉपी करके पुराना ब्लॉक मुक्त कर देता है; यदि ptr NULL हो तो यह malloc जैसा काम करता है।

4. Runtime Pitfalls: Memory Leaks, Dangling Pointers, Double Free & Fragmentation (रन-टाइम समस्याएं: मेमोरी लीक, डैंगलिंग पॉइंटर व फ्रैग्मेंटेशन)

[EN] Failing to call free() before losing the sole pointer to a heap block creates a Memory Leak that exhausts RAM in long-running services. Calling free(ptr) releases ownership back to the heap allocator without clearing the pointer variable itself, turning ptr into a Dangling Pointer—dereferencing it or calling free(ptr) a second time (Double Free) causes undefined behavior or security exploits. Frequent variable-sized allocations also create External Fragmentation inside the heap, unlike strictly LIFO stack frames.

[HI] यदि किसी हीप ब्लॉक का अंतिम पॉइंटर नष्ट हो जाए और free() न चलाया जाए, तो मेमोरी लीक (Memory Leak) होता है। free(ptr) चलाने से मेमोरी हीप को लौट जाती है, पर ptr वेरिएबल में पुराना पता बना रहता है—इसे डैंगलिंग पॉइंटर (Dangling Pointer) कहते हैं; इस पर दोबारा free() चलाना (Double Free) क्रैश या सुरक्षा खतरा पैदा करता है। बार-बार अलग आकार के ब्लॉक लेने-छोड़ने से हीप में एक्सटर्नल फ्रैग्मेंटेशन भी उत्पन्न होता है।

Syntax, Formula & Technical Example (Static vs Dynamic Memory Allocation in Data Structures)

#include <stdio.h>
#include <stdlib.h>

int main(void) {
    int *arr = (int *)calloc(3, sizeof(int));   // Zero-initialized: {0, 0, 0}
    if (!arr) return 1;
    int *tmp = (int *)realloc(arr, 5 * sizeof(int)); // Safe resize via temp
    if (tmp != NULL) { arr = tmp; arr[3] = 40; arr[4] = 50; }
    printf("arr[3]=%d\n", arr[3]);
    free(arr); arr = NULL;                       // Avoid dangling pointer
    return 0;
}

Static vs Dynamic Memory Allocation in Data Structures Quick Reference & Comparison Table

Allocation PrimitiveMemory Behavior & InitializationKey Exam Rule
Static AllocationFixed compile-time size on Stack or Data SegmentAuto-freed on scope exit; cannot resize at runtime
malloc(size)Allocates single uninitialized block on HeapContains garbage bytes; takes 1 byte-count argument
calloc(n, size)Allocates n blocks of size bytes zero-filledTakes 2 arguments; slightly slower due to zeroing
realloc(ptr, new_sz)Resizes existing heap block keeping old prefixMay relocate block; assign result via temp pointer

Static vs Dynamic Memory Allocation in Data Structures Top 20 Bilingual MCQs with Answers

Q1. Which standard C header file declares malloc(), calloc(), realloc(), and free()?

(C भाषा में malloc(), calloc(), realloc() और free() फंक्शन्स किस मानक हेडर फाइल में घोषित होते हैं?)

(A) <string.h>

(B) <stdlib.h>

(C) <stdio.h>

(D) <math.h>

Correct Answer: (B)

[EN] ISO C declares all four dynamic heap management functions in <stdlib.h>.

[HI] मानक ISO C में चारों डायनामिक मेमोरी फंक्शन्स <stdlib.h> हेडर में परिभाषित हैं।

Q2. What value does malloc() return when the heap cannot fulfill the requested memory size?

(यदि हीप में पर्याप्त मेमोरी उपलब्ध न हो, तो malloc() क्या मान लौटाता है?)

(A) A random garbage pointer

(B) -1

(C) 0xFFFFFFFF

(D) NULL

Correct Answer: (D)

[EN] All dynamic allocators (malloc, calloc, realloc) return NULL on failure, so callers must check for NULL before dereferencing.

[HI] मेमोरी आवंटन विफल होने पर malloc, calloc और realloc हमेशा NULL पॉइंटर लौटाते हैं।

Q3. What is the return type of malloc(), calloc(), and realloc() in standard C?

(मानक C में malloc(), calloc() और realloc() का रिटर्न टाइप क्या होता है?)

(A) char *

(B) size_t

(C) int *

(D) void *

Correct Answer: (D)

[EN] They return a generic void* pointer that converts implicitly to any object pointer type in C (and requires explicit cast in C++).

[HI] ये तीनों जेनेरिक void* पॉइंटर लौटाते हैं, जिसे किसी भी डेटा टाइप के पॉइंटर में बदला जा सकता है।

Q4. How many arguments do malloc() and calloc() take respectively?

(malloc() और calloc() में क्रमशः कितने आर्गुमेंट (Arguments) पास किए जाते हैं?)

(A) malloc takes 2 arguments; calloc takes 1 argument

(B) malloc takes 1 argument; calloc takes 2 arguments

(C) Both take 2 arguments

(D) Both take 1 argument

Correct Answer: (B)

[EN] malloc(total_bytes) accepts one size_t argument, whereas calloc(num_elements, element_size) accepts two.

[HI] malloc केवल कुल बाइट्स (1 आर्गुमेंट) लेता है, जबकि calloc तत्वों की संख्या और प्रत्येक का आकार (2 आर्गुमेंट) लेता है।

Q5. Which key difference distinguishes calloc() from malloc()?

(calloc() और malloc() के बीच सबसे प्रमुख तकनीकी अंतर क्या है?)

(A) malloc takes element count and size separately

(B) calloc allocates memory on the Stack instead of the Heap

(C) calloc automatically frees memory when a function returns

(D) calloc initializes all allocated bits to zero, while malloc leaves garbage values

Correct Answer: (D)

[EN] calloc zero-initializes the entire allocated block, whereas malloc leaves preexisting uninitialized bytes.

[HI] calloc आवंटित पूरी मेमोरी को शून्य (0) से भर देता है, जबकि malloc पुरानी गार्बेज वैल्यू ही छोड़ देता है।

Q6. On a 32/64-bit platform where sizeof(int) == 4, how many bytes are reserved by calloc(15, sizeof(int))?

(यदि sizeof(int) = 4 बाइट्स है, तो calloc(15, sizeof(int)) कुल कितनी मेमोरी आवंटित करेगा?)

(A) 15 bytes

(B) 60 bytes

(C) 30 bytes

(D) 19 bytes

Correct Answer: (B)

[EN] calloc reserves count * size = 15 * 4 = 60 contiguous heap bytes initialized to zero.

[HI] calloc कुल 15 * 4 = 60 बाइट्स की शून्य-प्रारंभिक मेमोरी आवंटित करेगा।

Q7. Which memory segment supplies storage for malloc(), calloc(), and C++ new expressions?

(malloc(), calloc() और C++ के new ऑपरेटर द्वारा मेमोरी किस सेगमेंट से ली जाती है?)

(A) Heap segment

(B) Call Stack segment

(C) Read-only .rodata segment

(D) Text (Code) segment

Correct Answer: (A)

[EN] Dynamic runtime allocations always draw memory from the Heap, unlike local non-static variables on the Stack.

[HI] डायनामिक मेमोरी आवंटन हमेशा हीप (Heap) सेगमेंट से होता है, स्टैक से नहीं।

Q8. What happens if you lose the only pointer pointing to a malloc-allocated block without calling free()?

(यदि किसी malloc से प्राप्त ब्लॉक का एकमात्र पॉइंटर नष्ट हो जाए और free() न चलाया जाए, तो क्या होता है?)

(A) Stack overflow

(B) Memory leak

(C) Compile-time syntax error

(D) Automatic garbage collection in C

Correct Answer: (B)

[EN] C has no built-in garbage collector; unreachable heap memory stays reserved until process termination, causing a memory leak.

[HI] C में गार्बेज कलेक्टर नहीं होता, इसलिए बिना free() किए पॉइंटर खोने पर मेमोरी लीक (Memory Leak) हो जाता है।

Q9. Why is setting ptr = NULL; immediately after free(ptr); considered best practice?

(free(ptr) चलाने के तुरंत बाद ptr = NULL करना क्यों उत्तम अभ्यास माना जाता है?)

(A) To immediately zero out every byte inside the heap block

(B) Because free() fails unless ptr is NULL beforehand

(C) It prevents ptr from remaining a dangling pointer and makes subsequent accidental free(ptr) safe

(D) To shrink the pointer variable size to 0 bytes

Correct Answer: (C)

[EN] free(ptr) leaves the stale address inside ptr (dangling pointer); resetting ptr to NULL turns accidental double-free into a harmless no-op.

[HI] free(ptr) के बाद ptr में पुराना पता (Dangling Pointer) बना रहता है; NULL सेट करने से अनजाने में दोबारा free(ptr) करने पर क्रैश नहीं होता।

Q10. Why should realloc() output be assigned to a temporary pointer first instead of overwriting ptr directly?

(realloc() का परिणाम सीधे ptr में रखने के बजाय पहले एक अस्थायी (Temporary) पॉइंटर में क्यों लेना चाहिए?)

(A) If realloc returns NULL on failure, directly overwriting ptr loses the original block and causes a memory leak

(B) Because realloc returns an integer status code rather than an address

(C) Because realloc always frees ptr even when expansion fails

(D) Because ptr cannot change its address once initialized

Correct Answer: (A)

[EN] When realloc fails, it returns NULL WITHOUT freeing the old block; overwriting ptr = realloc(ptr, ...) destroys the only reference to old data.

[HI] realloc विफल होने पर पुराना ब्लॉक मुक्त किए बिना NULL लौटाता है; सीधे ptr = realloc(ptr, ...) लिखने से पुराना पता खोकर मेमोरी लीक हो जाता है।

Q11. What is the exact behavior of calling realloc(NULL, 100) in ISO C?

(मानक C में realloc(NULL, 100) कॉल करने पर क्या होता है?)

(A) It crashes with a segmentation fault

(B) It behaves identically to malloc(100)

(C) It behaves like free(NULL) and returns 0

(D) It always returns NULL without allocating memory

Correct Answer: (B)

[EN] By the C standard, when the first argument to realloc is NULL, it allocates a fresh block of the requested size just like malloc.

[HI] ISO C मानक के अनुसार पहला आर्गुमेंट NULL होने पर realloc बिल्कुल malloc(100) की तरह नया ब्लॉक बनाता है।

Q12. What critical bug is caused by calling free(p); followed later by free(p); without reallocating p?

(एक ही आवंटित पॉइंटर p पर बिना नए आवंटन के दो बार free(p) चलाने से कौन सी गंभीर त्रुटि होती है?)

(A) Static binding error

(B) Double free (undefined behavior / heap corruption)

(C) Integer overflow

(D) Automatic memory compaction

Correct Answer: (B)

[EN] Freeing an already freed heap address corrupts allocator metadata and causes crashes or security vulnerabilities (Double Free).

[HI] पहले से मुक्त किए जा चुके ब्लॉक को दोबारा free() करना Double Free बग कहलाता है, जिससे हीप मेटाडेटा भ्रष्ट हो जाता है।

Q13. In C++, what major advantage do new/delete hold over malloc()/free() for class objects?

(C++ में क्लास ऑब्जेक्ट्स के लिए malloc()/free() की तुलना में new/delete का मुख्य लाभ क्या है?)

(A) malloc allocates on the Stack while new uses the Heap

(B) new invokes class constructors and delete invokes destructors automatically

(C) free() can invoke destructors automatically on void* pointers

(D) new never returns NULL or throws exceptions

Correct Answer: (B)

[EN] malloc/free only allocate and release raw bytes without calling C++ constructors or destructors.

[HI] malloc/free केवल कच्ची मेमोरी देते हैं, जबकि new ऑटोमैटिक कंस्ट्रक्टर तथा delete डिस्ट्रक्टर कॉल करता है।

Q14. Which problem affects long-running dynamic heap allocations more severely than LIFO stack allocations?

(LIFO स्टैक आवंटन की तुलना में डायनामिक हीप आवंटन में कौन सी समस्या अधिक गंभीर होती है?)

(A) Inability to store pointers

(B) Loss of global .bss variables

(C) External heap fragmentation due to non-sequential free order

(D) Compile-time fixed bounds error

Correct Answer: (C)

[EN] Allocating and freeing variable-sized blocks in arbitrary order leaves scattered free holes (external fragmentation) in the heap.

[HI] अलग-अलग आकार के ब्लॉक्स को अनियमित क्रम में आवंटित व मुक्त करने से हीप में बिखरे हुए खाली स्थान (External Fragmentation) बन जाते हैं।

Q15. What happens when you write: int *p = (int*)malloc(sizeof(int)); *p = 25; free(p); printf("%d", *p);

(निम्न कोड में क्या समस्या है: int *p = (int*)malloc(sizeof(int)); *p = 25; free(p); printf("%d", *p);)

(A) Use-after-free via a dangling pointer, leading to undefined behavior

(B) It reliably prints 0 in every C compiler

(C) Memory leak because free() failed

(D) Compile-time error because free() prohibits reading p

Correct Answer: (A)

[EN] Reading *p after free(p) accesses freed heap memory through a dangling pointer, which is undefined behavior in C.

[HI] free(p) के बाद *p को पढ़ना डैंगलिंग पॉइंटर (Use-after-free) का उपयोग है, जो अपरिभाषित व्यवहार (Undefined Behavior) पैदा करता है।

Q16. Which statement is NOT true regarding Static vs Dynamic Memory Allocation?

(स्टैटिक बनाम डायनामिक मेमोरी आवंटन के बारे में इनमें से कौन सा कथन असत्य (NOT true) है?)

(A) Static local variables on the stack are deallocated automatically on function return

(B) malloc() does not guarantee zero-initialized memory

(C) Static allocation allows resizing arrays at runtime via realloc()

(D) Dynamic memory persists on the heap until explicitly freed or program exit

Correct Answer: (C)

[EN] Static/stack arrays have compile-time or fixed frame sizes and can NEVER be resized with realloc() (realloc works only on heap pointers).

[HI] स्टैटिक या स्टैक एरे को रन-टाइम पर realloc() से बदला नहीं जा सकता; realloc केवल हीप से प्राप्त मेमोरी पर ही काम करता है।

Q17. Within Static vs Dynamic Memory Allocation in Data Structures, which allocation primitive directly maps to: "Fixed compile-time size on Stack or Data Segment"?

(Static vs Dynamic Memory Allocation in Data Structures में कौन सा Allocation Primitive सीधे "Fixed compile-time size on Stack or Data Segment" से संबंधित है?)

(A) realloc(ptr, new_sz)

(B) calloc(n, size)

(C) Static Allocation

(D) malloc(size)

Correct Answer: (C)

[EN] In Static vs Dynamic Memory Allocation in Data Structures, 'Static Allocation' handles 'Fixed compile-time size on Stack or Data Segment' (Auto-freed on scope exit; cannot resize at runtime).

[HI] Static vs Dynamic Memory Allocation in Data Structures में 'Static Allocation' का कार्य/विवरण 'Fixed compile-time size on Stack or Data Segment' (Auto-freed on scope exit; cannot resize at runtime) है।

Q18. Which option accurately describes 'malloc(size)' in Static vs Dynamic Memory Allocation in Data Structures?

(Static vs Dynamic Memory Allocation in Data Structures के संदर्भ में 'malloc(size)' की सही विशेषता कौन सी है?)

(A) Allocates n blocks of size bytes zero-filled

(B) Allocates single uninitialized block on Heap

(C) Fixed compile-time size on Stack or Data Segment

(D) Resizes existing heap block keeping old prefix

Correct Answer: (B)

[EN] 'malloc(size)' provides 'Allocates single uninitialized block on Heap' — key point: Contains garbage bytes; takes 1 byte-count argument.

[HI] 'malloc(size)' का मुख्य विवरण 'Allocates single uninitialized block on Heap' है (Contains garbage bytes; takes 1 byte-count argument)।

Q19. In Static vs Dynamic Memory Allocation in Data Structures, identify the correct parameter for the specification: "Allocates n blocks of size bytes zero-filled".

(Static vs Dynamic Memory Allocation in Data Structures में "Allocates n blocks of size bytes zero-filled" विवरण किस विकल्प के लिए सही है?)

(A) Static Allocation

(B) calloc(n, size)

(C) realloc(ptr, new_sz)

(D) malloc(size)

Correct Answer: (B)

[EN] 'calloc(n, size)' corresponds to 'Allocates n blocks of size bytes zero-filled' (Takes 2 arguments; slightly slower due to zeroing).

[HI] 'calloc(n, size)' का संबंध 'Allocates n blocks of size bytes zero-filled' (Takes 2 arguments; slightly slower due to zeroing) से है।

Q20. Considering Static vs Dynamic Memory Allocation in Data Structures, what key behavior defines 'realloc(ptr, new_sz)'?

(Static vs Dynamic Memory Allocation in Data Structures में 'realloc(ptr, new_sz)' की मुख्य भूमिका या मान क्या है?)

(A) Allocates n blocks of size bytes zero-filled

(B) Fixed compile-time size on Stack or Data Segment

(C) Resizes existing heap block keeping old prefix

(D) Allocates single uninitialized block on Heap

Correct Answer: (C)

[EN] 'realloc(ptr, new_sz)' represents 'Resizes existing heap block keeping old prefix' (May relocate block; assign result via temp pointer).

[HI] 'realloc(ptr, new_sz)' का अर्थ/मान 'Resizes existing heap block keeping old prefix' है (May relocate block; assign result via temp pointer)।

Static vs Dynamic Memory Allocation in Data Structures — Exam FAQs

Q1: Does free(ptr) erase the bytes in memory or set ptr to NULL automatically?

क्या free(ptr) चलाने से मेमोरी का डेटा मिट जाता है या ptr अपने आप NULL हो जाता है?

[EN] No. free(ptr) simply marks the heap block as available for future allocations. The old bytes often linger temporarily and ptr keeps holding the freed address until you explicitly write ptr = NULL;.

[HI] नहीं। free(ptr) केवल उस हीप ब्लॉक को दोबारा उपयोग के लिए उपलब्ध घोषित करता है। पुराना डेटा तुरंत शून्य नहीं होता और न ही ptr अपने आप NULL होता है—आपको स्वयं ptr = NULL लिखना चाहिए।

Q2: Why is malloc() slightly faster than calloc()?

malloc() को calloc() से थोड़ा तेज क्यों माना जाता है?

[EN] malloc() merely returns a block of raw uninitialized bytes in near-constant allocator time, whereas calloc() must additionally write zero across every single byte of the newly allocated memory.

[HI] malloc() बिना सफाई किए सीधे मेमोरी ब्लॉक का पता दे देता है, जबकि calloc() आवंटित की गई प्रत्येक बाइट में शून्य (0) भरने में अतिरिक्त समय लेता है।

Q3: Can free() be safely called on a NULL pointer in C?

क्या C में NULL पॉइंटर पर free(NULL) चलाना सुरक्षित है?

[EN] Yes. The ISO C standard explicitly guarantees that calling free(NULL) performs no operation (a safe no-op) and never crashes.

[HI] हाँ। मानक ISO C के अनुसार free(NULL) चलाना पूरी तरह सुरक्षित है और इससे कोई एरर या क्रैश नहीं होता (यह कोई कार्य नहीं करता)।

Related Posts

  • Loading related posts...

Post a Comment

Search Topic Notes & 20 MCQs (Hindi / English)