Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Reference for Dict Lab : A Serious Introduction to C: http://reed.cs.depaul.edu/lperkovic/csc406/homeworks/Dictlab.html Two files that you will be modifying are main.c and dict.c main.c : #include

Reference for Dict Lab : A Serious Introduction to C:

http://reed.cs.depaul.edu/lperkovic/csc406/homeworks/Dictlab.html

Two files that you will be modifying are main.c and dict.c

main.c :

image text in transcribedimage text in transcribed
#include #include W N #include "dict.h" 4 5 typedef struct dict_list { 6 char* key; char* val; 8 struct dict_list* next; 9 } dict_list_t; 10 11 typedef struct dict { 12 dict_list_t* head; 13 size_t size; 14 } dict_t; 15 16 17 dict_t* dict_create ( ) { 18 return NULL; 19 20 21 void dict_put (dict_t* dict, const char* key, const char* val) { 22 } 23 24 char* dict_get (const dict_t* dict, const char* key) 25 return NULL; 26 27 28 void dict_del (dict_t* dict, const char* key) { 29 } 30 31 size_t dict_size (const dict_t* dict) { 32 return Ou; 33 34 35 void dict_clear (dict_t* dict) { 36 37 38 void dict_destroy (dict_t* dict) { 39 40 41 void dict_apply (const dict_t* dict, const dict_apply_fun_t fun, void* arg) { 42 } 43main.c - dictlab [SSH: aspen.com.depaul.edu] W #include #include #include #include "dict.h" #define error(args. . .) do { fprintf (stderr, args); exit (1); } while (0) 9 10 11 char* readline (FILE* f) ; 12 13 int main (int argc, char** argv) { 14 dict_t* dict = dict_create (); 15 dict_destroy (dict); 16 17 18 #define BUFLEN 1024 19 20 char* readline (FILE* f) { 21 char* buf = NULL; 22 size_t alloc_len = 0; 23 ssize_t pos = -1; 24 25 while (1) { 26 int c = fgetc (f); 27 28 if (c == EOF) 29 return buf; 30 ++pos; 31 if (alloc_len

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions