Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following well. Read all directions, answer all parts and make sure you answer the parts correctly. You have to do this well. Use

Answer the following well. Read all directions, answer all parts and make sure you answer the parts correctly. You have to do this well. Use the code and everything, do as it says and answer the questions.
YOU NEED TO ANSWER ALL PARTS PLEASE, DONT JUST SEND THE CODE AND ANSWER FEW PARTS ANSWER ALL. you need to compile and execute the given code (with any necessary fixes) in a C++ development environment, examine the results, and then utilize the principles of pointer arithmetic and memory layout as discussed to respond to the particular question. Please do all that, I request, send proper code and output, this is important, before i move on to the question.
MAKE SURE TO ANSWER ALL PARTS AND MODIFY THE CODE BASED ON PARTS AND WHAT IT ASKS!!
For this assignment, you will need to run a C++program. Use the attached C++program, i have screenshotted it,i apologize if it may be alot to write down on ur compiler but please just type it down and run it and do the directions as followed. So I have sent the screenshot of the code we are working with. Following is the directions you have to do.
Consider the attached C++program.((this is not necessarily good code, as its main purpose is educational ). Run the program, commenting out the lines with blanks (you may need to modify the header for your system).Make sure you understand why you get the outputs your program produces before proceeding
that is after all the main point of this assignment.
You have to modify the code, add the lines in the questions that says for the mod, for the 805, the three blanks etc etc, make sure you send the proper code modified as stated in the instructions, and make sure your output is correct as asked too based on the questions and you send the output as well.
I will send the 8 parts to the question , it should not be that much, please answer all, i cant send 4 parts here and 4 another question because you need all 8 to solve this correctly and do the correct code modification.
Now based onBased on the programs output, determine how many bits your system uses to store short, regular, and long
integers. the code you modify, the running of it,answer the following eight parts
1. Based on the programs output, determine how many bits your system uses to store short, regular, and long integers.
2. You wish to determine how many bits your system uses to store pointers. Modify the program to determine this (label your modification MOD in comments), and state your conclusion
3. Based on your output, make a diagram indicating the addresses in memory where each of the programs variables are stored and their values at POINT 1. A sample diagram (not for the given program) may look like:
Address: Value: Name
0xABCDABF8123(x)
0xABCDABF430(foo.y[15])
...
???2k (foo.y[k])
0xABCDABB80(foo.y[0])
0xABCDABB48(foo. z)------p (points to foo)
0xABCDABB89(w)
Use that diagram as a model for question 3. Of course, you dont need to specify every single element for large arrays, as long as you make it clear you
understand whats going on. It is general practice to indicate the first and last elements, along with anarbitrary index k in the middle (as with foo in the above diagram, if the ??? is filled in).
4. Consider the output produced on the line labeled EXPLAIN that is in the code sent. Explain why you get this output (a brief explanation suffices as long as you show an understanding).
5. After understanding the program, can you make any conclusions about how C/C++ interpret addition on integers and pointers? Are they the same? Explain. Obviously, your explanation should point out the outputs that support your answer.
6. The program contains three blanks. Fill the first two with appropriate integer constants to print 805 for both new outputs. Depending on your platform, it is possible (though unlikely) that your original program will produce a strange error message (e.g.,bus error,segmentation error) before you get to this point. If so, you should try another compiler or computer.
7. Fill in the third blank in the program to print 947.
8. Does your compiler allocate local scalar variables growing up or down in memory (i.e., higher or lower addresses)? Explain how you know this from your program output.
These are all the 8 parts, please do it well. I have the code attached, modify the code and change it, as such asked and make sure output is correct. Please make sure all answers are correct. Do this well, please.
image text in transcribed

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago