Chapter 9


1.

What does it mean to say that pointers are type-specific?

the pointer must be of the same data type as the variable it is pointing to.

2.

What happens when you have an int pointer named p and you execute the expression p++?

the pointer moves over four bytes.

3.

What does a pointer point to?

it points to the address in memory of some variable.

4.

Where is one place that pointers are often used?

with arrays

5.

Arithmetic operations on a pointer do what?

move the pointer over a certain number of bytes.

6.

What is the & operator?

the address of operator

7.

What is **p?

it is a pointer to a pointer.

8.

Why would you want to create a function pointer?

so you can pass that function as an argument to other functions

9.

What is a pointer?

a variable that points to an address in memory, rather than a value

10.

Why don’t pointers support multiplication?

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.

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.




C++ Programming Fundamentals
C++ Programming Fundamentals (Cyberrookies)
ISBN: 1584502371
EAN: 2147483647
Year: 2005
Pages: 197
Authors: Chuck Easttom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net