C++ Programming Fundamentals (Cyberrookies)
| 1. | What does it mean to say that pointers are type-specific? | |
| 2. | What happens when you have an int pointer named p and you execute the expression p++? | |
| 3. | What does a pointer point to? | |
| 4. | Where is one place that pointers are often used? | |
| 5. | Arithmetic operations on a pointer do what? | |
| 6. | What is the & operator? | |
| 7. | What is **p? | |
| 8. | Why would you want to create a function pointer? | |
| 9. | What is a pointer? | |
| 10. | Why don’t pointers support multiplication? | |
Answers
| 1. | The pointer must be of the same data type as the variable it is pointing to. |
| 2. | The pointer moves over four bytes. |
| 3. | It points to the address in memory of some variable. |
| 4. | With arrays |
| 5. | Move the pointer over a certain number of bytes. |
| 6. | The address of operator |
| 7. | It is a pointer to a pointer. |
| 8. | So you can pass that function as an argument to other functions |
| 9. | A variable that points to an address in memory, rather than a value |
| 10. | Because pointers contain addresses, multiplication and division do not make sense. If a pointer supported multiplication, the multiplication operation might cause it to point to some memory location that does not exist on your computer. |
Категории