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.
In a rectangular floor of length and breadth of 22 metres and 16 metres, respectively, square tiles each of 2 metre edge length are to be laid. If the c...
If the circumference of a circle is 308 cm then find the area of the circle?
The ratio of the curved surface area and total surface area of a cylinder is 16 : 17 . If the curved surface area of the cylinder is 308m². Find th...
A rectangular piece of copper foil of length 21 cm and area 1386 cm2 is folded along its width to form a cylinder such that there is only one...
- Determine which solid has a greater volume.
I) A cuboid having dimensions 7 cm, 10 cm, and 6 cm
II) A cube with each edge measuring 9 cm The length of a rectangle is 64 cm. If the ratio of length to perimeter of the rectangle is 4:15, find the area of a circle whose diameter is 6 cm less ...
In a division the quotient is 12, the divisor is 15 and the remainder is 7. What is the dividend?
If each side of a rectangle is increased by 2 m, the area increases by 124 m². The ratio of perimeters (square : rectangle) is 4:5. Find the side of th...
A rectangular garden is 30 m long and 24 m wide. A path of uniform width 2 m is built inside along the boundary of the garden. Find the area of the path.
A Solid Cone of height 18cm diameter of its base 36cm is cut from a wooden Solid sphere of radius 18cm. the percentage of wood wasted is ?