Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 . Given the definitions : int t[30]; int *p; Is this statement correc

ID: 3805028 • Letter: Q

Question

Question 1. Given the definitions :

int t[30];

int *p;

Is this statement correct ? t = p; (Answer required in Yes or No)

Is this statement correct ? p = t; (Answer required in Yes or No)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Question 2. Given the definitions and intializations :

double s[10];

double *p = s;

If we next execute : p += 10; an error will result. (Answer required in Yes or No)

Then, if we next execute : *p = 1.0; an error will result. (Answer required in Yes or No)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Question 3. Consider the following program slice :

char c1, *p;

void fun(char *p);

c1 = 'Z';

p = &c1;

fun(p);

The function fun could change the contents of p. (Answer required in Yes or No)

The function fun could change the contents of c1. (Answer required in Yes or No)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Answers are required per language C.

Explanation / Answer

Question 1:

Answer is No for both questions.

Both statements are false.

Question 2:

Answer is No for both questions.

Again both statements are false.

Question 3:

The first part answer is No. It cannot change the contents of p, it can only chance the contents of c1.

The second part answer is Yes.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote