1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Rep Power

    2D array of structure

    typedef struct object product, *pprod;
    struct object{
    int type;
    char name[10];
    pprod next;
    int main()
      pprod (*t)[10] = malloc(sizeof(t) * 10);
    what this definition mean pprod (*t)[m] = malloc(n * sizeof *t);?
    how to access the member of structure? when i tried to access structure member its segmentation fault.
    if not whats the right way of define array of this structure?

    Basically what is this pprod mean? how to define a structure using it?
    concept of the syntax if explained would help a lot.
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Rep Power
    Since we are unable to read your mind, we cannot possibly have any idea what you mean by "when i tried it shows me error." Tried what? What error?

    Show us the code! Preferably, a short complete program in which you try what you say you are trying and you get the error that you vaguely mentioned. Use code tags to post it!

    [code] copy-and-paste your formatted code listing here [/code]

    BTW, you didn't mention any warnings that you're getting. Never ignore warnings. Warnings are much more important than error messages are. And never try to run a program that gives you warnings; that program is broken and will not do what you think it should. Never ignore warnings.

IMN logo majestic logo threadwatch logo seochat tools logo