Assignment 5 … Data Next pointer Data Next pointer Data Next pointer

Slides:



Advertisements
Similar presentations
SYMBOL TABLES &CODE GENERATION FOR EXECUTABLES. SYMBOL TABLES Compilers that produce an executable (or the representation of an executable in object module.
Advertisements

Introduction to Linked Lists In your previous programming course, you saw how data is organized and processed sequentially using an array. You probably.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Data Structures: A Pseudocode Approach with C
Linked Lists Compiled by Dr. Mohammad Alhawarat CHAPTER 04.
Linked Lists Chained nodes of information create what are called linked lists, with each node providing a link to the next node. A useful feature of linked.
Grade 12 Computer Studies HG
Dynamic memory allocation and Pointers Lecture 4.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Lecture – Pointers1 C++ Pointers Joseph Spring/Bob Dickerson School of Computer Science Operating Systems and Computer Networks Based on notes by Bob Dickerson.
Data Management Data Verification Data Validation.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
CPS120: Introduction to Computer Science Lecture 16 Data Structures, OOP & Advanced Strings.
 Array is a data structure were elements are stored in consecutive memory location.in the array once the memory is allocated.it cannot be extend any more.
Doubly Linked List Exercises Sometimes it is useful to have a linked list with pointers to both the next and previous nodes. This is called a doubly linked.
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
UNIT-II Topics to be covered Singly linked list Circular linked list
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
Overview Working directly with memory locations is beneficial. In C, pointers allow you to: change values passed as arguments to functions work directly.
Lecture 3 Translation.
Winter 2009 Tutorial #6 Arrays Part 2, Structures, Debugger
Pointers and Linked Lists
Chapter 7 Pointers and C-Strings
Pointers and Linked Lists
Introduction to Linked Lists
A bit of C programming Lecture 3 Uli Raich.
Practical Office 2007 Chapter 10
Review Deleting an Element from a Linked List Deletion involves:
CS2006- Data Structures I Chapter 5 Linked Lists I.
MIS 215 Module 1 – Unordered Lists
CS Data Structures Chapter 8 Lists Mehmet H Gunes
CS 1114: Implementing Search
Pointers, Polymorphism, and Memory Allocation
Objectives Identify the built-in data types in C++
Computer Systems and Networks
Discussion 6 HW4 and Libraries.
Dynamic Memory Allocation
This pointer, Dynamic memory allocation, Constructors and Destructor
Introduction to Linked Lists
Dynamic Memory Allocation
Array Lists Chapter 6 Section 6.1 to 6.3
Object Oriented Programming COP3330 / CGS5409
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Linked List Lesson xx   In this presentation, we introduce you to the basic elements of a linked list.
Chapter 18: Linked Lists.
Popping Items Off a Stack Lesson xx
Hw 5 Hints.
STUDENT INFORMATION SYSTEM (SIS)
Pointers and Linked Lists
Pointers, Dynamic Data, and Reference Types
More About Data Types & Functions
Week 9 – Lesson 1 Arrays – Character Strings
Programming II (CS300) Chapter 07: Linked Lists and Iterators
CS2011 Introduction to Programming I Arrays (I)
A Simple Two-Pass Assembler
HTML Links.
Topics discussed in this section:
Chapter 4 Unordered List.
Data Structures & Algorithms
Chapter 9: Pointers and String
Programming in C Pointers and Arrays.
COP3530- Data Structures Introduction
COP 3330 Object-oriented Programming in C++
Pointers and References
CS31 Discussion 1H Fall18: week 7
Microsoft Access Tips and Tricks
Pointers, Dynamic Data, and Reference Types
SPL – PS2 C++ Memory Handling.
How to install and manage exchange server 2010 OP Saklani.
Presentation transcript:

Assignment 5 … Data Next pointer Data Next pointer Data Next pointer Class material may be found on optlab.mcmaster.ca in ./COMPENG701_5_C/C_lecture.zip, login/pwd: ces701 0. Install LCC on your machine. The validity of your code will be tested against this compiler. Install Cygwin and gcc as described in class (refer to Kevin Sheppard’s webpage for configuration needed). Write a C program to manipulate a one-directional closed linked list. An entry of the list will contain the name of a person (string), a year of birth (integer) and weight (double). Your program must have a command-line interface, e.g., “Press H for help, 1 – to add a new entry, 2 – to delete current entry, …” and support the following functionality: add a new entry to the list (ask for name, date of birth, weight), print current entry in the list onto the screen (display the information above for the current entry), find a first entry in the list that matches search criteria which may be specified as name, weight or date of birth, delete current entry from the list, delete all the entries in the list, quit. Your program must create new entries in the dynamic memory using, say, calloc/free functions. No static pre-allocation of the list entries is allowed (you cannot simply reserve a large array upfront to store all your data). Hints: For your code, you might want to: define a structure type having fields Name, DOB, Weight and Next using typedef, where Next is the pointer to the next entry in the list, define an auxiliary pointer to the current entry in the list and set it to NULL if the list is empty, navigate through the list using something like CurrentEntry=(*CurrentEntry).Next, make sure you clean up the memory once the entry is deleted from the list. The following diagram explains what a closed single linked list is: Data Next pointer Data Next pointer Data Next pointer … Data Next pointer