Quiz Yourself on Pointer Arithmetic
Test your understanding of the material presented in this chapter.
1
Given the following code:
int* ptr1 = 12345;
char* ptr2 = 10000;
What’s the output of the following operations (the operations are independent, and the result of one doesn’t influence another):
ptr1++
ptr1 + ptr2
ptr1 + 5
A)
12349
Invalid operation
12365
B)
12349
Invalid operation
12350
C)
12346
22345
12365
D)
12346
Invalid operation
Invalid operation
Question 1 of 70 attempted
Get hands-on with 1400+ tech skills courses.