logo

Crowdly

Browser

Add to Chrome

Consider the following function: void incr(char** ptr) { ++ptr; } and the...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Consider the following function:

void incr(char** ptr)

{

++ptr;

}

and the following code excerpt (i.e a part of a code that is elsewhere correct),

where you have to add two instructions, one for u and one for v:

char msg[] = "CS-202";

char* tab[] = { msg + 1, msg + 3 };

char* p = msg + sizeof(msg) - 1;

char** u = tab;

char** v = &p;

incr(u);

// add one statement on u

// add one statement on v

for (char* r = *u; r < *v; ++r) putchar(*r);

What should be added (one instruction for u and one instruction for v) so that the above code prints "20"?

Penalty for wrong ticks.

0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.epfl.ch?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome