I have this code:
#include <stdio.h>
#include <stdlib.h>
int main() {
    int i,j,width,height,operatie;
    struct pixel {
       unsigned char r, g, b;
    } ;
    struct pixel **poza;
    scanf("%d",&operatie);
    scanf("%d",&width);
    scanf("%d",&height);
    poza = malloc ( height * width * sizeof(pixel));
    for (i=0 ; i<height ; i++ ) {
        for ( j=0 ; j<width ; j++ ) {
            scanf("%c",&(poza[i][j].r));
            scanf("%c",&(poza[i][j].g));
            scanf("%c",&(poza[i][j].b));
        }
    }
    for (i=0 ; i<height ; i++ ) {
        for ( j=0 ; j<width ; j++ ) {
            printf("%d ",(poza[i][j].r));
            printf("%d ",(poza[i][j].g));
            printf("%d ",(poza[i][j].b));
        }
        printf("\n");
    }
    return 0;
}
I want to know how I can use malloc, calloc and realloc on this.
Please explain to me, if you can, how it works.
 
     
    