1Explain the pointer data type and pointer variables 2Explor

1.Explain the pointer data type and pointer variables

2.Explore how to declare and manipulate pointer variables

3.Use the address of operator and the dereferencing operator to manipulate dynamic variables

4. Explore how to use the new and delete operators to manipulate dynamic variables

5. Explain how pointer arithmetic is related to the manipulation of arrays

Respond to item 1 above using one descriptive paragraph; be short and to the point.

Respond to item 3 above by way of two examples, be short and to the point

Respond to item 5 above by way of two examples, be short and to the point

c++

textbook: c++ from control structures through objects 8th edition.

chapter 9: pointers

Solution

1.

Pointer data type: The actual data type of the value of all pointers, whether integer, float, character, or otherwise, is the same, a long hexadecimal number that represents a memory address. The only difference between pointers of different data types is the data type of the variable or constant that the pointer points to.

Pointer variable: A pointer is just like an int: a number. It happens to be a number that identifies a memory location, and if something is stored in that memory location you can call it an address. Like an int, a pointer can be stored in a variable. A variable that stores a pointer could be called a pointer variable

2.

Declare pointer variable: To access the value of variable, pointer is dereferenced, using the indirection operator * . int a,*p; a = 10; p = &a; printf(\"%d\",*p); //this will print the value of a. printf(\"%d\",*&a); //this will also print the value of a. printf(\"%u\",&a); //this will print the address of a.

Manipulate pointer variable: The value “pointed to” by a pointer can be “retrieved” or dereferenced by using the unary * operator; for example: int *p = ..., etc

1.Explain the pointer data type and pointer variables 2.Explore how to declare and manipulate pointer variables 3.Use the address of operator and the dereferenc

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site