Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Role of pointers to implement different Data Structures?

role of pointer

5 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    if you study different data structure then you might know none of the data structure without pointer; even array is also named as constant pointer..

    Generally pointer is to point out the location of data and data structure is to organize data .where the organize leads to positioning..

    so, pointers play vital role regards Data structure for both single data and also set of data(node)

  • Anonymous
    1 decade ago

    I also at first thought that pointers are of no real use, but now I am of a completely different opinion, I think that they are the backbone of programming. Anyway, if you have one data location (as in a linked list), then for the computer to know where the next location is, you need a pointer, so that your program does not goto the wrong memory places. Pointers are also used to dynamically (during runtime) create and use variables (memory), using the new operator or the malloc() function.

  • Anonymous
    1 decade ago

    The role of a pointer is to save data structures in a memory allocation in RAM.

    For example, if you want to access elements in a array, you can use a pointer to access those elements.

  • ?
    Lv 4
    4 years ago

    A pointer won't be a information shape itself, yet i assume you will desire to assert it has a information shape (although a particularly trouble-free one). A pointer (it quite is usually a variable of a few kind that encompasses a memory handle) factors to an merchandise in memory. the item in memory has a information shape - the information shape defines the information that it includes. as an occasion, the information shape for a motor vehicle may well be 2 bytes, the place the 1st byte represents the colour of the vehicle and the 2nd represents the form of motor vehicle. the information shape for a pointer has a single ingredient it quite is a memory area (it quite is usually a style). as an occasion, you're transforming into a pointer which factors to a blue computerized motor vehicle it quite is in area a million, so the pointer has the fee a million. you could then replace the pointer so as that it factors to a pink handbook motor vehicle in area 2, so the fee of the pointer is now 2.

  • 1 decade ago

    Pointers can be used to create data structures such as linked list, tree, etc

    a linked list can be visualized as follows :

    a ---> b --> c --> d

    a,b,c,d are variables of the following stucture :

    struct ele

    {

    int data;

    struct ele *nextptr;

    };

    DETAILED PICTURE OF LINKED LIST for above example picture(You can now see how exactly a pointer is used here):

    a (data1, nextptr = &b) //a contains the address of next variable b.....

    b(data2,nextptr =&c)

    c(data3,nextptr = &d)

    d(data4,nextptr = NULL)

Still have questions? Get your answers by asking now.