Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CPSC2380-01 Spring 2020 6. (20 Points) Given the following program, (a) trace the output by drawing the memory model as the program runs. (b) What

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
CPSC2380-01 Spring 2020 6. (20 Points) Given the following program, (a) trace the output by drawing the memory model as the program runs. (b) What does printf("%d ", ptr2 - ptri) print in C/C++? #include using namespace std; int main() {1.5, 1.0, 3.5); float arr [3] = float *ptrl; float *ptr2; ptrl - &arr [0]; ptr2 = ptrl + 2; printf("X X X ", arr, ptri, system("PAUSE"); return 0; output 3AFDCO 3AFDCO 3AFDC8 Press any key to continue. (ANSWER] SADC gested Sites Imported From IE G O SoloLearn: Learn to... Angle (Degrees) an. ES CKGS USA - Passpo... Cygwia 7. (10 Points) Given the following program, #include using namespace std; #include int main() float arr (5) - {12.5, 10.0, 13.5, 90.5, 0.5); float *ptrl; float *ptr2; ptrl - &arr [0]; ptr2 - ptrl + 3; printf("%X X X ", arr, ptri, ptr2); printf("%d ", ptr2 - ptrl); printf("%d ", (char*)ptr2 - (char*)ptrl); system("PAUSE"); return 0; __(T/F) arr is equivalent to &arr[0] (T/F) ptr2 is equivalent to &arr[3] (T/F) number of elements between ptr2 and ptr 1 is 3 (T/F) number of bytes between ptr2 and ptri is 3 (T/F) This program will cause a compiler error + SPITZUH2DX?projector=1&message Partid=0.1 Suggested Sites DIDUUR Imported From IE G O SoloLearn: Learn to... 17) number or elements between purz ana pri 153 Angle (Degrees) an. CKGS USA - Passpo. Cygwi (T/F) number of bytes between ptr2 and ptri is 3 (T/F) This program will cause a compiler error 8. (10 Points) What will be the output of the following code? #include using namespace std; void main() char *s = "hello"; char *p - S; cout program? int xyz (int *ptr) *ptr = 30; int main() int y - 20; xyz (by); printf("%d", y); return 0; +

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions