Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

The Turn-In « Each question that asks you to write a program (Qs 1, 4-6) should have have its own source file titled question-.c where o I've attached a simple makefile for you to use. Note that the...

1 answer below »
The Turn-In
« Each question that asks you to write a program (Qs 1, 4-6) should have have its own source file titled question-.c where © Question 1 will ask you to create null.c. You should still name your file question-1.c.
« Include one makefile that compiles all of the source into individual executables. The makefile should support the -g option by default. Output file name format should be question-o I've attached a simple makefile for you to use. Note that the makefile compiles with debug symbols by default.
« Each question that asks you to run a utility like gdb or valgrind should also include a text file showing the output
« Source code, Makefile, and output text should be zipped together as "assignment-2.zi

the question number. ie. question-1.c, question-4.c, etc.

a paste of from your terminal window). Text file format should be question-.txt

+ Responses to the questions should be answered and submitted in a separate Microsoft Word or PDF document named "assignment-2.docx” or "assignment-2.pdf” (this is so | can use the webcourses built-in viewer to
ead your responses) while I'm grading.
Clarifications
+ Some questions are simple "yes or no" responses. e.g., Question 3 asks "Can you interpret the output from the tool?" Don't just give a
significance. If if asks "does it run?” (or similar), explain why or why not.
+ Some questions ask you to describe the behavior of running the program or one of the debug utilities. e.g.
esults. What does the output mean?
Ru
ic (25 pts total)
|Question| Points.

inary answer. If you can interpret the output, describe it and give its
"What happens when you run..." Your output txt is not sufficient to answer the question. Interpret the
So [a[E[e[n]=
ss elolas&
In the written responses, I'm looking for:
« No major grammatical or spelling e
ors.
+ Co
ectness. Is your answer technically co
ect?
+ Can you demonstrate clear understanding of the mechanisms and concepts prompted by the question?

not just give a What, but also a Why?
Homework (Code)
In this homework, you will gain some familiarity with memory allo-
cation. First, you'll write some. (fun). Then, you'll use
Some tls to help you ind the bugs you inserted. Then, you will elize
how awesome thes tls are and 1 them in the future, thus making
yourself more happy and luctive. The tools are the debugger (e.g.
nd mem geen ced ve ger ONO :
‘Questions
1. Fist, wit a simple program called m3. that creates a pointe
oor een see 1 and he es denen i Com
pile this into an executable called ad. What happens when you
Fon this program?
2. Next, compile this program with symbol information included (with
the 5 flag). Doing so lets put more information into the exe-
cutable, enabling the 10 access more useful information
about variable names and the like. Run the program under the de-
Dugger i 1 and then, once gc is running,
REESE wo yout “ ope
3. Fil seth vo toolonthis progam, Wel seth senchck
a part of valor ind to analyse what happens, Rum
nthe following: valor ing —Leak-camckoyes
Batya pens when yon man thst Can you interpret she
utput rom the ol?
4. Write imple program that allocates memory using na Loc ) but
orgs toe Foon xing, What happeie wh this pogrom
Fa? Can yo use as 1 fd ay Profs with Hob spout
TaLring (gain withthe ——Loar-checkoyes fag)?
5. Write program that creates an a
ay of integers called dat 2 of size
100 using malloc; then, set daca [100] to zero. What happens
when you run this program? What happens when you run this.
program using valgrind? Is the program co
ect?
6. Create a program that allocates an a
ay of integers (as above), frees
them, and then tries to print the value of one of the elements of
the a
ay. Does the program run? What happens when you use
valgrindonit?
7. Now pass a funny value to free (e.g, a pointer in the middle of the
a
ay allocated above). What hay 2 Do you need tools to
Teg hos Va pes Do
Answered 8 days After Oct 09, 2022

Solution

Ria answered on Oct 17 2022
51 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here