Exercises

C Pointers and Memory Addresses

Explore how pointers work in C through questions about memory addresses, address-of and dereference operators, pointer assignment, arrays, dynamic allocation, null pointers, dangling pointers, and multiple levels of indirection. This quiz combines conceptual knowledge, code tracing, memory diagrams, and practical safety rules.

Answer the questions below and check the explanation for each answer.

0/7 answered

  1. 1

    Which expression produces the memory address of the variable x?

    Question 1
  2. 2

    What is the value of x after this code runs: int x = 7; int *p = &x; *p = 12;?

    Question 2
  3. 3

    If p points to an element of an int array, what does p + 1 point to?

    Question 3
  4. 4

    What does p become if its allocated memory is freed but p is not reassigned?

    Question 4
  5. 5

    What does *p evaluate to after this code: int a = 3, b = 5; int *p = &a; p = &b;?

    Question 5
  6. 6

    Given int x = 9; int *p = &x; int **pp = &p;, what does **pp access?

  7. 7

    What does the declaration const int *p mean?

Download the App now to have access to + 5000 free courses, exercises, certificates and lots of content without paying anything!

  • 100% free online courses from start to finish

    Thousands of online courses in video, ebooks and audiobooks.

  • More than 60 thousand free exercises

    To test your knowledge during online courses

  • Valid free Digital Certificate with QR Code

    Generated directly from your cell phone's photo gallery and sent to your email

Cursa app on the ebook screen, the video course screen and the course exercises screen, plus the course completion certificate