Skills101
← All practice quizzes

Quiz: C Pointers

5 questionsNo time limitPass: 60%+10 XP on first pass

The topic every C learner fears, made simple with pictures. Addresses, & and *, pointers and arrays, pointer arithmetic, NULL, pointer to pointer and const pointers.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    #include <stdio.h>
    int main(void) {
        int x = 5;
        int *p = &x;
        *p = *p + 10;
        printf("%d", x);
        return 0;
    }
    
  2. Question 2

    For int a[] = {2, 4, 6, 8};, what is *(a + 3)?

  3. Question 3

    If p is an int pointer holding address 1000 (int = 4 bytes), what address is p + 2?

  4. Question 4

    What does this print?

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

    What happens when you dereference a NULL pointer?