Question
Write a C program that reads in a ppm image using command line arguments and then stores its pixel contents in a linked list of
Write a C program that reads in a ppm image using command line arguments and then stores its pixel contents in a linked list of pixels. A header file, transform.h, is provided below, where you will use the two provided structs for declaring the linked list and the function prototypes parseHeader() to get the width and height of the ppm image, and getImage(), to send the width, height, and image pointer to get the pixel data and create the linked list.
transform.h
#include
// Linked list node typedef struct pixel { unsigned char r, g, b; struct pixel * next; }pixel_t;
typedef struct list { pixel_t * head; pixel_t * tail; } list_t;
void parseHeader( FILE *input, int *cols, int *rows ); void getImage( FILE *input, int rows, int cols, list_t * theImage );
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