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 #include #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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!