Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Practice this question and more.


What does the expression '*s++' accomplish within the 'oneChar' function?

  1. Decrements the pointer 's'

  2. Increments 's' after dereferencing

  3. Dereferences 's' then increments the pointer

  4. Checks if 's' is not null before incrementing

The correct answer is: Dereferences 's' then increments the pointer

This expression dereferences the pointer 's' then increments the pointer, essentially accessing the current element and then moving the pointer to the next element in the string. Option A is incorrect because it decrements the pointer instead of incrementing it. Option B is incorrect because it increments 's' before dereferencing, meaning it will access the next element instead of the current one. Option D is incorrect because it checks if 's' is null, which is not relevant in this expression.