/* This is the template for your IS2610 assignment 2 due next week Sept 22 Your assignment is to malloc space for a color image in memory, fill it with some interesting pattern of your own design, and then write it out into a PPM format file. The purpose of this is not really to make pretty pictures but is to understand the relation between arrays and pointers. The image in memory acts like a 3D array except that the pointers only let you access it one dimension. There are ways around this limitation but for our purpose you need to do the proper indexing yourself using pointer arithmetic or one dimensional array notation. On Unix/Linux you could directly view the image using xv or can convert it to jpeg to stick on a web page using cjpeg. $ gcc asn2.c $ a.out 640 480 > image.ppm $ xv image.ppm $ cjpeg < image.ppm > image.jpg */ #include #include main(int argc, char *argv[]) { unsigned char *image, *tempptr; int x, y, c, width, height; if(argc < 3) { fprintf(stderr, "Usage: %s width height\n", argv[0]); exit(1); } width = atoi(argv[1]); height = atoi(argv[2]); // ***** Your code to generate the image and write it out as a PPM file return(0); }