What will be the output of the following C code?
AMI technical mcq question, verified with a worked answer. Free to practise - no sign-up.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a[] = {1, 2, 3, 4, 5};
int *p = a;
++*p;
printf("%d ", *p);
p += 2;
printf("%d", *p);
return 0;
}
Show answer & explanation
Answer: A. 2 3
Standard evaluation according to engineering and computational science principles.
Step-by-step Derivation:
Step 1: Analyze problem specification.
Step 2: Derive theoretical solution.
Step 3: Select corresponding answer option.