#include #include typedef struct { char P2[3]; // valtozo a "P2"-nek int h, w, max, // magassag, szelesseg es max ertek beolvasasahoz **t; // 2D dinamukus tombhoz pointer } PGM; int main () { int i, j; PGM img1; FILE *in, *out; // FILE IO-hoz in = fopen("progalap.pgm","r"); // progalap.pgm megnyitasa olvasasra out = fopen("inverted.pgm","w"); // inverted.pgm eloallitasa irasra fscanf(in, "%s%d%d%d", &img1.P2, &img1.w, &img1.h, &img1.max); // az elso negy valtozo beolvasasa // printf("%s\n%d %d\n%d\n", img1.P2, img1.w, img1.h, img1.max); // beolvasas helyessegenek tesztelese // dinamikus memoria foglalas img1.t = malloc(img1.h*sizeof(int*)); for (i = 0; i