Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need answered ASAP c++ Exercise R7.8 . Which of the following assignments are legal in C++? void f(int p[]) { int* q; const int* r;

Need answered ASAP c++

Exercise R7.8. Which of the following assignments are legal in C++?

void f(int p[])

{

int* q;

const int* r;

int s[10];

p = q;

p = r;

p = s;

q = p;

q = r;

q = s;

r = p;

r = q;

r = s;

s = p;

s = q;

s = r;

}

Exercise R7.9. Given the definitions

double values[] = { 2, 3, 5, 7, 11, 13 };

double* p = values + 3;

explain the meanings of the following expressions:

a. values[1]

b. values + 1

c. *(values + 1)

d. p[1]

e. p + 1

f. p values

Exercise R7.12. What is the difference between the following two variable

definitions?

a. char a[] = "Hello";

b. char* b = "Hello";

Exercise R7.13. What is the difference between the following three variable

definitions?

a. char* p = NULL;

b. char* q = "";

c. char r[] = { '\0' };

Exercise R7.14. Consider this program segment:

char a[] = "Mary had a little lamb";

char* p = a;

int count = 0;

while (*p != '\0')

{

count++;

while (*p != ' ' && *p != '\0') p++;

while (*p == ' ') p++;

}

What is the value of count at the end of the outer while loop?

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago