Pointers cannot be used to

2022

Pointers cannot be used to

  1. A.

    find the address of a variable in memory

  2. B.

    reference value directly

  3. C.

    simulate call by reference

  4. D.

    manipulate dynamic data structure

Attempted by 865 students.

Show answer & explanation

Correct answer: B

Answer: Pointers cannot be used to reference a value directly.

Explanation: A pointer stores the memory address of a variable. To access or modify the value at that address you must dereference the pointer using the * operator. Therefore, pointers provide indirect access to values, not direct aliasing.

  • Finding an address: pointers hold addresses. Example: int x = 5; int *p = &x; // p stores the address of x

  • Simulating call by reference: pass an address to a function. Example: void inc(int *p) { (*p)++; } then call inc(&x);

  • Manipulating dynamic structures: pointers link nodes and manage dynamic memory. Example: Node *n = malloc(sizeof(Node)); n->next = anotherNode;

Key idea: Pointers operate on addresses; to get or set the underlying value use the dereference operator. The phrase "reference value directly" implies being an alias to the variable itself, which is not how pointers behave in C.

Explore the full course: Mppsc Assistant Professor