Data Structures Using C
M. Campbell
© 1993 Deakin University
Module 815
Data Structures Using C
Aim
After working through this module you should be able to create and use new and complex data types within C programs.
Learning objectives
After working through this module you should be able to: 1. Manipulate character strings in C programs. 2. Declare and manipulate single and multi-dimensional arrays of the C data types. 3. Create, manipulate and manage C pointers to data elements. 4. Create and manage complex data types in C. 5. Use unions to define alternate data sets for use in C programs. 6. Allocate memory to variables dynamically. 7. Manipulate characters and bits.
Content
Strings. Arrays. Pointers. Data definitions – Structures. Data definitions – Unions. Dynamic allocation of data Character and bit manipulation
Learning Strategy
Read the printed module and the assigned readings and complete the exercises as requested.
Assessment
Completion of exercises and the CML test at the end of the module.
Page 813-1
Module 815
Data Structures Using C
References & resources
The C Programming Language. 2nd. edition Brian W. Kernighan and Dennis M. Ritchie Prentice-Hall, 1988 Turbo C/C++ Manuals. Turbo C/C++ MS DOS compiler.
Page 813-2
Module 815 Objective 1
Data Structures Using C After working through this module you should be able to manipulate character strings in C programs
Strings
A string is a group of characters, usually letters of the alphabet. In order to format your printout in such a way that it looks nice, has meaningful titles and names, and is aesthetically pleasing to you and the people using the output of your program, you need the ability to output text data. We have used strings extensively already, without actually defining them. A complete definition of a string is ‘a sequence of char type data terminated by a NULL character,’. When C is going to use a string of data in some