E N D
1. The C Language Brief Tutorial
3. Word Count Program Associated Functions
4. Word Count Program Alternate Function Definition
5. Example Using Pointers and Dereferences
6. Call by Reference using Pointers C Only Allows Pass-by-Value
Using Pointers Facilitates Pass-by-Ref
Cant change the Pointer Value
Change What Pointer References
Consider Swap Below
7. Call by Reference using Pointers If you want to Swap the Value of the Pointer (addresses)
Use Pointers to Pointers
Change What Pointer Points To
In this Case, an Address
8. Pointers and Count Lines Revisit Count_Lines
Change to Return Value in Parameter
Function now Returns Void
9. Correlating Pointers and Arrays An Array Name is a Fixed Address
10. Basic Concepts for Strings String Processing in C is Achieved via Character Arrays
Strings Terminate with \0
11. Passing Strings as Parameters
12. Three Other Versions of Copy
13. String Functions in C Defined in #include <strings.h>
Integer Returning Functions:
Pointer Returning Functions
14. Structures Structures in C are the Predecessors of Classes
Allow Named Groupings
Passed as Parameters
What are some Examples?
15. Structures More Examples
16. Structures More Examples
17. Structures A Poker Example
18. Structures A Poker Example
19. Poker Other Functions
20. Poker Other Functions
21. Lists and Memory Allocation Structures can be Leveraged to Create Lists of Self-Referential Data
Students in a Class
Cards in a Poker Hand
Consider a Hand as Follows
As Defined, Hand can have Multiple Cards (in fact, one or More)
Structure General
Poker, Blackjack, Bridge, etc.
22. Lists and Memory Allocation
23. Lists and Memory Allocation Example as Given is Very Limited
Requires Know Ahead of Time
Number of Elements in List
How you Want to Connect Them
Well use a Word Count Version as Example for These Concepts
24. Word Count - Continued
25. Word Count - Continued
26. All Structures for Project - .h File
27. All Structures for Project - .h File
28. Code for Project - .c File
29. Project 1 Part A Recall Word Count Program from Slides 2 and 3 You must
Code Missing Functions
Compile on Eclipse C++
Test and Prepare Test Summary
Test Summary Document Must
Identify Test Cases and for each
List Purpose of Test
List Input (input files)
List Output (cntrl-alt-printscreen)
Create MS Word Document that is Professional, Structure, Organized
Code in zip file on Course Web Page
Due on Monday, Jan 23, 8am (electronic submission only)
30. Project 1 Part B Redo and Expand Word Count Prog. to Explore Dynamic Memory Allocation
Step 1: Store All File Names, and Lines (max 256 char/line) in Linked List Structures
input_file and line_list as reviewed
Step 2: Redo Part 1A (line, word, and char counts) using a Traversal of the Linked List Structure
input_file and line_list
Step 3: Compute a Permuted Index (see the project description) Using other Linked List Structures
references and permuted_index
Code in zip file on Course Web Page
Due on Wednesday, Feb 1, 8am (electronic submission) and hard copy at start of Lab Session