Difference Between Data Structures and Pointers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cbvsastry
    New Member
    • Oct 2006
    • 1

    Difference Between Data Structures and Pointers

    Hi,

    I always had a doubt regarding the difference between pointers and data structures... Could anyone give me the clarification.. .
  • vimase
    New Member
    • Oct 2006
    • 5

    #2
    Originally posted by cbvsastry
    Hi,

    I always had a doubt regarding the difference between pointers and data structures... Could anyone give me the clarification.. .
    Pointers are constructs that point to the address location of a particular data type. Ofcourse, pointers also need to have data types associated with them, i.e. while declaring we have to define the data type of the pointer, for e.g.
    int * p;
    char * p1;
    but the pointer is just pointing to the memory location, which holds the particular variable. So by just changing the reference of the pointer, the same pointer can point to any variable of that particular data type.

    Comment

    • dasarisrikar
      New Member
      • Sep 2006
      • 18

      #3
      Pointer is a variable which holds the address of another variable....... ..........
      int *p; which means...
      1)p is a variable which holds the address of integer variable
      (or)
      2)p is a pointer points to an integer

      so pointer hold the address of a variable accordingly.

      Data structure:
      the organization of data (and its storage allocations in a computer)
      in data structure pointers are widly used... as pointers deals vth da memory adress.....we can easily organise data using pointers.

      Comment

      • mohiniu
        New Member
        • Dec 2013
        • 2

        #4
        pointers are "constructs "...
        what are "constructs "?

        Comment

        • mohiniu
          New Member
          • Dec 2013
          • 2

          #5
          good explanation disarisikar

          Comment

          • Sherin
            New Member
            • Jan 2020
            • 77

            #6
            DATA STRUCTURE

            Structure refers to a collection consisting of elements of heterogenous data type
            Structure uses “.” (Dot operator) for element access
            Instantiation of Structure objects is possible.
            Bit filed is possible in an Structure.
            Structure is a user-defined datatype.


            ARRAY


            Array refers to a collection consisting of elements of homogenous data type.
            Array uses subscripts or “[ ]” (square bracket) for element access
            Instantiation of Array objects is not possible.
            Bit filed is not possible in an Array.
            Arrays is a primitive datatype

            Comment

            • Banfa
              Recognized Expert Expert
              • Feb 2006
              • 9067

              #7
              Not incorrect @Sherin but the question was difference between a structure and a pointer not a structure and an array.

              Note that arrays are not pointers in several very significant ways. Sometimes, because the name of an array variable used alone decomposes to a pointer to the first element of an array people confuse pointers and arrays but it is better not to.

              For example using the sizeof operator the sizeof an array is the actual size of all the data in the array so that sizeof array/sizeof array[0] is the number of entries in the array. Size of a pointer is either 4 or 8 or less often now 2 (depending on your platforms pointer size) sizeof pointer/sizeof pointer[0] is meaningless.

              Comment

              Working...