Computer Programming (13) - User Defined data structures


administrivia

Web Page - http://www.cs.tau.ac.il/~efif/courses/ComputerProgramming


user-defined data structures


structures


example


structure parts


structure members


structure variable definition


structure variable definition


full structure declaration


structure optional parts


forward declaration


accessing members of structures


operations on structures


built-in operations on structures


operations on structures

  • anything else we have to write our own code
    /* add two two complex numbers */
    struct complex cpx_add(struct complex c1, struct complex c2)
    {
      struct complex sum;
      sum.real = c1.real + c2.real;
      sum.imag = c1.imag + c2.imag;
      return sum;
    }
    

    pointers to structures


    pointers to structure members


    linked data structures


    a singly-linked list


    a singly-linked tiny list


    operate on a singly-linked list


    iterate a singly-linked list


    growing a singly-linked list


    prepending an item to a list


    prepending an item to a list


    logical operation evaluation


    prepending an item to a list


    building a singly-linked list


    other data structure


    examples

    lectures prev top
    Maintained by Efi Fogel. Last modified: January 14 2003.