CS3376 Pointers

The ___, also known as the address operator, returns the memory address of a variable.

ampersand (&)

With pointer variables, you can ___ manipulate data stored in other variables.

indirectly

The statement "int *ptr;" has the same meaning as

int* ptr;

When you work with a dereferenced pointer, you are actually working with

the actual value of the variable whose address is stored in the pointer variable

These can be used as pointers.

array names

The contents of pointer variables may be changed with mathematical statements that perform

addition and subtraction

A pointer may be initialized with

the address of an existing object

What does "double *num2;" do?

declares a pointer variable named num2

When the less than operator is used between two pointer variables, the expression is testing whether

the address of the first variable comes before the address of the second variable in the computer's memory

The statement "sum += *array++;"

assigns the dereferenced pointer's value, then increments the pointer's address

Use the delete operator only on pointers that were

created with the new operator

A function may return a pointer, but the programmer must ensure that the pointer

still points to a valid object after the function ends

These statements are not valid C++ code

1) int ptr = &num1; 2) int ptr = int *num1; 3) float num1 = &ptr2;

This statement deletes memory that has been dynamically allocated for an array

delete [] array;

When this is placed in front of a variable name, it returns the address of that variable

ampersand (&)

What does "cout << &num1;" output?

the memory address of the variable called num1

A pointer variable is designed to store

a memory address

What does the word int mean in "int *ptr;"?

ptr is a pointer variable that will store the address of an integer variable

If ptr is a pointer variable, what does "cout << *ptr;" output?

the value stored in the variable whose address is contained in ptr

The ___ and ___ operators can be used to increment or decrement a pointer variable

++, --

Not all arithmetic operations may be performed on pointers. For example, you cannot ___ or ___ a pointer

multiply, divide

This statement displays the address of the variable num1

cout << &num1;

The statement "cin &gt;&gt; *num3;"

stores the keyboard input into the variable pointed to by num3

Dynamic memory allocation occurs when

a new variable is created at runtime

The statement "int *ptr = new int;"

assigns an address to the variable named ptr

When using the new operator with an older compiler, it is wise to

test the pointer for the NULL address

Every byte in the computer's memory is assigned a unique

address

When you pass a pointer as an argument to a function, you must not

1) redeclare the pointer variable in the function call 2) dereference the pointer variable in the function prototype 3) use the #include<func_ptr.h> statement 4) not dereference the pointer in the function's body

A pointer variable may be initialized with

any address in the computer's memory

If a variable uses more than one byte of memory, for pointer purposes its address is

the address of the first byte of storage

CS3376 Pointers - Subjecto.com

CS3376 Pointers

Your page rank:

Total word count: 551
Pages: 2

Calculate the Price

- -
275 words
Looking for Expert Opinion?
Let us have a look at your work and suggest how to improve it!
Get a Consultant

The ___, also known as the address operator, returns the memory address of a variable.

ampersand (&)

With pointer variables, you can ___ manipulate data stored in other variables.

indirectly

The statement "int *ptr;" has the same meaning as

int* ptr;

When you work with a dereferenced pointer, you are actually working with

the actual value of the variable whose address is stored in the pointer variable

These can be used as pointers.

array names

The contents of pointer variables may be changed with mathematical statements that perform

addition and subtraction

A pointer may be initialized with

the address of an existing object

What does "double *num2;" do?

declares a pointer variable named num2

When the less than operator is used between two pointer variables, the expression is testing whether

the address of the first variable comes before the address of the second variable in the computer’s memory

The statement "sum += *array++;"

assigns the dereferenced pointer’s value, then increments the pointer’s address

Use the delete operator only on pointers that were

created with the new operator

A function may return a pointer, but the programmer must ensure that the pointer

still points to a valid object after the function ends

These statements are not valid C++ code

1) int ptr = &num1; 2) int ptr = int *num1; 3) float num1 = &ptr2;

This statement deletes memory that has been dynamically allocated for an array

delete [] array;

When this is placed in front of a variable name, it returns the address of that variable

ampersand (&)

What does "cout &lt;&lt; &amp;num1;" output?

the memory address of the variable called num1

A pointer variable is designed to store

a memory address

What does the word int mean in "int *ptr;"?

ptr is a pointer variable that will store the address of an integer variable

If ptr is a pointer variable, what does "cout &lt;&lt; *ptr;" output?

the value stored in the variable whose address is contained in ptr

The ___ and ___ operators can be used to increment or decrement a pointer variable

++, —

Not all arithmetic operations may be performed on pointers. For example, you cannot ___ or ___ a pointer

multiply, divide

This statement displays the address of the variable num1

cout << &num1;

The statement "cin &gt;&gt; *num3;"

stores the keyboard input into the variable pointed to by num3

Dynamic memory allocation occurs when

a new variable is created at runtime

The statement "int *ptr = new int;"

assigns an address to the variable named ptr

When using the new operator with an older compiler, it is wise to

test the pointer for the NULL address

Every byte in the computer’s memory is assigned a unique

address

When you pass a pointer as an argument to a function, you must not

1) redeclare the pointer variable in the function call 2) dereference the pointer variable in the function prototype 3) use the #include<func_ptr.h> statement 4) not dereference the pointer in the function’s body

A pointer variable may be initialized with

any address in the computer’s memory

If a variable uses more than one byte of memory, for pointer purposes its address is

the address of the first byte of storage

Share This
Flashcard

More flashcards like this

NCLEX 10000 Integumentary Disorders

When assessing a client with partial-thickness burns over 60% of the body, which finding should the nurse report immediately? a) ...

Read more

NCLEX 300-NEURO

A client with amyotrophic lateral sclerosis (ALS) tells the nurse, "Sometimes I feel so frustrated. I can’t do anything without ...

Read more

NASM Flashcards

Which of the following is the process of getting oxygen from the environment to the tissues of the body? Diffusion ...

Read more

Unfinished tasks keep piling up?

Let us complete them for you. Quickly and professionally.

Check Price

Successful message
sending