All mock tests are FREE till 31 December — register to save your progress
Unit 3 · Programming Languages and Computer Graphics Paper 2 CS · June 2024 (Re-Exam)

#include<stdio.h>
void main()
{
int arr[ ] = {1, 2, 3, 4, 5};
int *p = arr;
printf("%d", *p++);
printf("%d", *(p+1));
}

Find the output of the above code?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. 1,3

Explanation

*p++ prints *p (1) and then moves p to arr[1]. *(p + 1) is arr[2] = 3. Output: 1 then 3.

More Programming Languages and Computer Graphics questions