[Solved] Access element of array of pointer of structure


#include <stdio.h>
#include <stdlib.h>

int main()
{
    struct hash {
        int pages;
        int price;
    };
    struct hash *h[2];
    h[0] = malloc(sizeof(struct hash));
    h[0]->pages = 1;
    h[0]->price = 2;
    h[1] = malloc(sizeof(struct hash));
    h[1]->pages = 3;
    h[1]->price = 4;
    printf("value = %d\n", h[0]->pages);
}

solved Access element of array of pointer of structure