Pointers – Multiple Choice Questions (MCQs)
-
-
38. What is the output of the following code? `int arr[] = {10, 20}; int *ptr = arr; printf(\%d %d\"",*ptr++,*ptr);` (Note: Order of evaluation might vary)"""
-
39. What is the output of the following code? `int a = 1, b = 2; int *p1 = &a; int *p2 = &b; *p1 = *p2; printf(\%d %d\"",a,b);`"""
-
40. What is the output of the following code? `int arr[3] = {5, 10, 15}; int *ptr = arr + 2; printf(\%d\"",*ptr);`"""
-
41. What is the output of the following code? `int num = 7; int *ptr = # printf(\%p\"",ptr);`"""
-
42. What is the output of the following code? `int val = 3; int *p = &val; int *q = p; *q = 6; printf(\%d\"",val);`"""
-
43. What is the output of the following code? `int data[2] = {100, 200}; int *ptr1 = data; int *ptr2 = &data[1]; printf(\%d %d\"",*ptr1,*ptr2);`"""
-
44. What is the output of the following code? `int value = 42; int *point = &value; printf(\%d\"",(*point)++); printf(\""%d\"""
-
45. What is the output of the following code? `int num_arr[] = {5, 10}; int *ptr_arr = num_arr; printf(\%d \"",*ptr_arr++); printf(\""%d\"""
-
46. What is a pointer to a constant integer in C?
-
47. How do you declare a pointer to a constant integer in C?
-
48. What is a constant pointer to an integer in C?