Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: please write answer in the context of c++ language 1) Given an int x: Declare a pointer xptr to x. Use xptr to print

Note: please write answer in the context of c++ language

1)

Given an int x:

Declare a pointer xptr to x.

Use xptr to print out xs value.

Use xptr to assign a value of 7 to x.

Assign the address of xptr to a variable. What is its type?

2)What value should be assigned to a pointer that does not have a valid address?

3)

Given a string str:

Declare a pointer strptr to str.

Use strptr to print out strs value.

Use strptr to assign the value abc to str.

Use strptr to print out strs length.

4)

Given the following array and pointer declarations:

int arr[] { 1, 2, 3, 4, 5 };

int* arrptr = arr;

what is the output of each of the following statements? (assume they are not executed consecutively)

  1. cout << *arrptr;
  2. cout << *arrptr++;
  3. cout << *++arrptr;
  4. cout << ++*arrptr;
  5. cout << (*arrptr)++;

Write a statement that finds the number of elements in arr.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

Students also viewed these Databases questions

Question

Please solve entire case

Answered: 1 week ago

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago