Pointers – Multiple Choice Questions (MCQs)
-
-
26. What is memory leakage in the context of pointers and dynamic memory allocation?
-
27. Which standard library function is used to allocate a block of memory dynamically in C?
-
28. Which standard library function is used to release a dynamically allocated block of memory in C?
-
29. What is the purpose of the `sizeof()` operator when used with a pointer?
-
30. What is the difference between `ptr++` and `(*ptr)++` if `ptr` is an integer pointer?
-
31. What is the output of the following code? `int a = 10; int *ptr = &a; printf(\%d\"",*ptr);`"""
-
32. What is the output of the following code? `int arr[] = {1, 2, 3}; int *ptr = arr; printf(\%d\"",*(ptr + 2));`"""
-
33. What is the output of the following code? `int a = 5; int *ptr = &a; *ptr = 15; printf(\%d\"",a);`"""
-
34. What is the output of the following code? `int x = 20; int *p = &x; int **q = &p; printf(\%d\"",**q);`"""
-
35. What is the relationship between pointer arithmetic and array indexing?
-
36. What is the purpose of using pointers with functions?