my first time here. Tried to find a solution through searching, but i still cant see my problem here:

Struct

```
typedef struct
{
    float** image_data;  
    int m;             
     int n;             
} image;

```

shorted main

```
int main(int argc, char *argv[])
{
    int m, n, c, iters;
    image u;
    unsigned char *image_chars;
    char *input_jpeg_filename, *output_jpeg_filename;

    /*funtion importing jpeg sets chars and hight/width (works)*/ 
    import_JPEG_file(input_jpeg_filename, &image_chars, &m, &n, &c);

    allocate_image (&u, m, n);
    printf"m og n (in main function): %i %i\n", u->m, u->n);

    return 0;
}

```

allocating function

```
void allocate_image(image *u, int m, int n)
{
    u = malloc(sizeof(struct image));

    u->m=m;
    u->n=n;

    int i;
    u->image_data=(float**)malloc(m*sizeof(float*));
    for(i=0; i<m; i++){
        u->image_data[i]=(float*)malloc(n*sizeof(float));
    }

    printf("m og n: %i %i\n", u->m, u->n);
}

```

Should mention its a part of school assignment, but I was told there was no harm in asking rudimentary questions here. I'm also limited to C89.

So as an experienced coder may already see, it doesn't allocate properly. the m and n values are printed correctly inside the allocate function, but I'm not allowed to use u->m for some reason outside. I have a feeling I messed up some pointers vs. addresses, but I can't find it..

As for remaking all the code, I would like to try and keep the variables inside main (no globals).