Answered step by step
Verified Expert Solution
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:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is my code from Lab 4 (Exercise 3) for Exercise 1:
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started