i have a struct node and i put it in an array.how to make pointer to it insid array?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mohamed mostafa
    New Member
    • Dec 2010
    • 1

    #1

    i have a struct node and i put it in an array.how to make pointer to it insid array?

    i want to make a pointer to a node inside an array...how can i make it??
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    So you have a node structure, and an array of these structures, and you want to set a pointer variable to point at the ith node in the array.

    You can do this in exactly the same way you would if it was an array of longs:
    Code:
    int i;
    long *p, array[100];
    ...
    p = &array[i];

    Comment

    Working...