Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need a C program for the following: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- This is my code from Lab 4 (Exercise 3) for Exercise 1: Challenge Questions / Exercises

I need a C program for the following:

image text in transcribed

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

This is my code from Lab 4 (Exercise 3) for Exercise 1:

image text in transcribed

Challenge Questions / Exercises In this part of the Clab you will have to write three C programs based on what has been learned in the lectures and labs up to this point. In these questions in this lab and later labs, marks are given for code which compiles and runs (even if it doesn't meet the specification), good comments and layout, and also for code which performs the required tasks (for the more complex tasks in later labs, partially working code may get partial marks in this category). Exercise 1-Refactoring your own code In Lab 3, you wrote a simple program to print a PGM format image, and in Lab 4, you modified it to split out the code into multiple functions. Starting with your code from Lab 4, split out the function to print out the PGM file into a separate C source file (called printpgm.c). Create an appropriate header file to allow your function to be used in other code., with a suitable prototype. Modify the code in the original file to include the header file appropriately. Compile your two C files, and link appropriately, and test that the code still does what it is supposed to do. Write an appropriate makefile so that anyone can compile the full code, and add appropriate compiler flags to enable debugging (-g) and the 199 standard (-std=c99). The makefile from Exercise 3 may help with this as a starting point. You should have appropriate comments in all of the files, including the makefile, and present your code in a consistent and readable manner. Three C source code files (2.c, 1.h), and one makefile, are your submission for this exercise. i 2 #include 3 #include 4 5 int fill(unsigned short int image[15][15], int width, int height, int max) // Defines function that fills image 6 7-{ 8 int i = 1; 9 for(i; i 2 #include 3 #include 4 5 int fill(unsigned short int image[15][15], int width, int height, int max) // Defines function that fills image 6 7-{ 8 int i = 1; 9 for(i; i

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

Poor choice of channels can reduce communication eff ectiveness.

Answered: 1 week ago

Question

What is the timeline for each tactic?

Answered: 1 week ago

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago

Question

LO1 Discuss four different views of motivation at work.

Answered: 1 week ago

Question

LO6 Summarize various ways to manage retention.

Answered: 1 week ago