Question
Consider the following code snippet. What is the output
of the program? #include < stdio.h > int main ( ) { int arr[5] = {1, 2, 3, 4, 5}; int *ptr = arr; ptr + = 2; printf("%d", *ptr); return 0; }Solution
In the code, ptr initially points to the first element of the array arr. The line ptr += 2; moves the pointer two positions ahead, meaning ptr now points to the third element of the array, which is 3. Therefore, *ptr dereferences the pointer to print the value 3. Why Other Options are Wrong: a) 1 is the first element, but the pointer has moved past it. b) 2 is the second element, but ptr skips over it. d) 4 is the fourth element, but ptr stops at the third. e) 5 is the fifth element, beyond where ptr is pointing.
The coach says that they have best equipment.
Select the most appropriate option expressed in direct speech.
She always took her medicines on time.
A report submitted by an expert panel to party president said that the party needed active promotion of second-rung leaders in Punjab, where Assembly el...
Select the most appropriate indirect form of the given sentence.
David said, “Don’t worry Frank. I will bring you up to date when I meet you ...
The manager said "Vivek must go tomorrow to meet the client".
Select the most appropriate indirect/direct form of the given sentence.
She promised, “I will call you tomorrow.”
I rarely watch action movies.
The teacher said to me, "Stand here next to the podium."
Ankita said that she ……………… to be a doctor.