c - Segmentation fault when trying to write a modified structure
问题 This is in a program meant to work with ppm image files. I'm getting a compilation error when trying to modify a struct and then writing it to a new file. This is the global struct (declared in ppmIO.c and ppmIO.h): ppmIO.c: struct Image *instance; ppmIO.h: struct Image { int width; int height; unsigned char *data; }; extern struct Image *instance; This is my imageManip.h file: #include <ppmIO.h> void ImageInvert(struct Image **toInvert); void ImageSwap(struct Image **toSwap); These are the