Relationship Between Arrays and Pointers in C: 10 Solved MCQs

Test the difference between arrays and pointers through 10 solved C questions. Each answer traces the expression, address movement, or declaration step by step.

KnowledgeGate Team

Exam prep & CS education

14 Aug 20268 min read

In most expressions, an array name can supply the address of its first element, but an array is not simply a pointer. The difference appears in pointer scaling, subtraction, &array + 1, pointer-to-array declarations, and side effects such as *p++. Each of the 10 questions below is traced from the element the pointer starts on to the value that finally gets printed. If the underlying ideas feel unfamiliar, revise Arrays and Strings in C first.

1. Arrays and pointers: a four-step tracing method

For each question, pause before reading the answer and work the trace on paper:

  1. Write what the pointer currently points to.

  2. Apply any increment or offset in the correct order.

  3. Translate x[y] into *(x + y).

  4. Dereference only after the pointer expression is settled.

Pointer addition advances in elements of the pointed type, not raw bytes. Subtracting two pointers into the same array gives the distance in elements. The address of a whole array carries its own type, so &a + 1 steps over the entire array while a + 1 steps over a single element.

Use the wider Coding and DSA courses when you need structured practice. After every miss, record the first incorrect step in your trace, not merely the correct option.

2. Array subscripting and dereferencing through offsets

The central equivalence is x[y] == *(x + y). Because addition is commutative, i[num], *(num + i), and *(i + num) reach the same element when the expressions are otherwise valid.

For example, with int num[] = {10, 20, 30, 40}; int i = 2;, the expressions num[2], *(num + 2), 2[num], and *(2 + num) all evaluate to 30.

Question 1

Asked in: UP Police 2018

 Which of the following C statements can also be used in place of num[i]?
(i) *(num + i )
(ii) i[num]
(iii) *(i+num)
A. Only (ii)
B. (i), (ii) and (iii)
C. Only (i)
D. Only (iii)

Answer: B. (i), (ii) and (iii).

Start with num[i] == *(num + i), so statement (i) is valid. Also, i[num] == *(i + num). Since i + num and num + i identify the same location, statements (ii) and (iii) are valid too. With num = {10, 20, 30, 40} and i = 2, all four forms select index 2 and give 30.

Question 2

Asked in: Hexaware 2023

Consider the code snippet below. What is the output?

int arr[] = {1, 2, 3};
int *ptr = arr;
printf("%d", *(ptr + 2));
A. 1
B. 2
C. 3
D. Compilation error

Answer: C. 3.

The assignment ptr = arr makes ptr point to arr[0], whose value is 1. Adding 2 moves by two int elements, so ptr + 2 points to arr[2]. Therefore, *(ptr + 2) == arr[2] == 3.

If this translation is still slow, practise more array patterns in Array Basics MCQs in C.

3. Pointer arithmetic scales by element size

Keep the units visible. If p is an int *, then p + k advances by k integers. If p and q point into the same array, q - p reports the number of elements between them.

Question 3

Asked in: Indian Space Research Organization 2023

Pointer p points to an array of integers where each integer has size 2 bytes. If p is initialized to address 200, what is the value of p + 3?

A. 206
B. 203
C. 212
D. 204

Answer: A. 206.

The pointer advances by three complete integers. Each integer here occupies 2 bytes, so the displacement is 3 × 2 = 6 bytes. The illustrative address becomes 200 + 6 = 206. The tempting calculation 200 + 3 = 203 incorrectly treats pointer addition as raw byte addition.

Question 4

Asked in: GATE 2024

What is the output of the following C program?

#include <stdio.h>
int main() {
double a[2]={20.0, 25.0}, *p, *q;
p = a; q = p + 1;
printf("%d,%d", (int)(q - p), (int)(*q - *p));
return 0;
}
A. 4,8
B. 1,5
C. 8,5
D. 1,8

Answer: B. 1,5.

Here, p points to a[0] = 20.0. Then q = p + 1 points to a[1] = 25.0. The pointer difference is q - p = 1 element, not a byte count. The value difference is *q - *p = 25.0 - 20.0 = 5.0. After the casts, the pair is 1,5.

4. Valid pointer operations and indexing around a moved pointer

A pointer may be shifted by an integer, and two pointers into the same array may be subtracted. Adding two pointer values is not a defined array-navigation operation. For a negative subscript, translate it before judging whether the access is valid.

Question 5

Asked in: Coal India 2017

Which of the following statements is INCORRECT with respect to the pointers declared in the following C code?

void main()
{
    int a[10], *p, *q;
    p = &a[5];
    q = &a[7];
}
A. q-p
B. p+1
C. q-3
D. p+q

Answer: D. p+q.

Both pointers refer into a. Their difference is q - p = 7 - 5 = 2 elements. The expression p + 1 points to a[6], while q - 3 points to a[4]. The expression p + q tries to add two pointer values, which does not produce a meaningful array location in C.

Question 6

Asked in: UGC NET 2023

Consider the code segment below, then arrange the four printf statements in increasing order of their output.

int arr[] = {0,1,2,3,4};
int i=1,*ptr;
ptr=arr+2;

(A)  printf("%d",ptr[i]);
(B)  printf("%d",ptr[i + 1]);
(C)  printf("%d",ptr[-i]);
(D)  printf("%d",ptr[-i+1]);
A. (C), (A), (B), (D)
B. (C), (D), (A), (B)
C. (D), (A), (B), (C)
D. (A), (B), (D), (C)

Answer: B. (C), (D), (A), (B).

Here ptr = arr + 2, so ptr points to the value 2, and i = 1.

  • C: ptr[-1] == *(ptr - 1) == arr[1] == 1.

  • D: ptr[-1 + 1] == ptr[0] == arr[2] == 2.

  • A: ptr[1] == arr[3] == 3.

  • B: ptr[2] == arr[4] == 4.

The outputs rise as 1, 2, 3, 4, so the order is C, D, A, B.

5. Postfix increment and dereference precedence

Parse the expression before tracing it. Postfix ++ binds more tightly than unary *, so *p++ means *(p++). The old pointer is dereferenced, and then the stored pointer advances.

Question 7

Asked in: UGC NET 2024

What is the output of the following C program?

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

Answer: B. 1, 3.

The first expression is *(p++). It reads arr[0] = 1 through the old pointer, then leaves p pointing to arr[1]. Now p + 1 points to arr[2], whose value is 3. The calls print 1 and 3 consecutively because their format strings contain no comma, while option B represents the value pair 1, 3.

Question 8

Asked in: Accenture 2024

Predict the output of the following C program.

main()
{
int num[ ]={1,4,8,12,16};
int *a,*b;
int i;
a=num;
b=num+2;
i=*a++;
printf("%d, %d, %d\n",i,*a,*b);
}
A. 1,4,8
B. 4,1,8
C. 2,1,8
D. 4,4,8

Answer: A. 1,4,8.

Track the variables separately. Initially, a = &num[0], b = &num[2], and *a = 1. In i = *a++, the old pointed value goes into i, so i = 1, and then a advances to &num[1]. Pointer b does not move. At the print, i = 1, *a = 4, and *b = 8.

6. Pointer-to-array declarations and the address of a whole array

Read a declaration from the identifier outward. Parentheses make p a pointer first in int (*p)[5], and the pointed object is a complete five-integer array. This differs from int *p[5], which declares an array of five integer pointers.

Question 9

Asked in: UP LT Grade 2018

What is the meaning of the following declaration in C programming language?

int (*p)[5];
A. It will result in compile error because there should not be any parenthesis, i.e., "int *p[5]" is valid
B. p is a pointer to 5 integers
C. p is a pointer to integer array
D. p is a pointer to an array of 5 integers

Answer: D. p is a pointer to an array of 5 integers.

The parentheses bind *p before [5], so p points to one entire array containing five integers. For example, int row[5] = {11, 22, 33, 44, 55}; int (*p)[5] = &row; makes (*p)[3] equal to 44. By contrast, int *p[5] makes p an array whose five elements are integer pointers.

Question 10

Asked in: TCS 2025

Predict the output of the following C program.

#include <stdio.h>
int main()
{
    int a[] = {1, 2, 3, 4, 5, 6};
    int *ptr = (int *)(&a + 1);
    printf("%d", *(ptr - 1));
    return 0;
}
A. 6
B. 5
C. 0
D. error

Answer: A. 6.

The expression &a points to the whole six-element array. Therefore, &a + 1 advances by one complete array and reaches the location just after a. After conversion to int *, ptr - 1 moves back by one integer and points to a[5]. Dereferencing it gives 6. The end location is also where a + 6 points, but a + 1 and &a + 1 advance in different type-sized units.

7. Answer-pattern checklist and the next practice step

Before choosing an answer, check five things:

  • Translate x[y] to *(x + y).

  • Label the type of the object being pointed to.

  • Keep pointer offsets and differences in elements.

  • Parenthesise *p++ as *(p++).

  • Distinguish p, &p, a, and &a before calculating.

Use your misses diagnostically. Questions 1 to 4 test array-to-pointer conversion in expressions, subscripting, and scaling. Questions 5 to 8 test legal operations, indexing around a moved pointer, and precedence. Questions 9 and 10 test declaration reading and whole-array types.

The short version is that an array name often supplies a pointer to its first element in an expression, but array type and pointer type remain distinct. Continue with the C Language course for concept-plus-MCQ revision, or browse Complete Placement Preparation for wider placement practice.