Monash University > CSSE > CSE1303 > Part A > Tutorials > Tutorial A4
This tute covers material from lectures A07 to A09.
There may not be time in the tutorial to cover all of these questions. Attempt at least the ones marked with an asterisk before the tutorial; these are the ones that will be focussed on during the class. If you have specific questions about unmarked questions, you can ask the tutor about them during the tutorial. If you want further revision questions, suggestions of questions from the textbooks are provided at the end of the tutorial sheet.
Note: The purpose of tutorials is not simply to give you the answers to these questions! (Solutions will be released in about a week online, so if all you want is the answers, there are easier ways.)
typedef struct NodeRec {
int value;
struct NodeRec* nextPtr;
} Node;
typedef struct StackRec {
Node* topPtr;
} Stack;
#include "linkQueue.h" float item; Queue theQueue;
Assume at some stage the Linked Queue associated with theQueue can be represented as in the following diagram:
Now assume that the following function call is then made:
item = serve(&theQueue);
struct DoubleLinkNodeRec
{
char* str;
struct DoubleLinkNodeRec* nextPtr;
struct DoubleLinkNodeRec* previousPtr;
};
typedef struct DoubleLinkNodeRec Node;
Write a C function that reads a string from the user that could be in any of the following formats, and outputs the correct output as shown below:
|
number p |
Print "Line number to be printed is number-1" |
|
$r string |
Print "Reading from filename: string" |
|
d number |
Print "Deleting line number: number" |
Where number is an
integer, string is
a character string. The other characters there: $r,
p, and d
are to be read literally.
Make sure you deal with invalid input.
Deitel & Deitel 2e
Self Review Exercises 12.1 c, h, 12.2, 12.3, 12.4 a-e
Exercises: 12.6, 12.7
Last modified 2002-07-03