Skip to content

Commit e3ea29c

Browse files
committed
remove cast in sorted hash example
1 parent aa2b4ba commit e3ea29c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ void zfree_hash_table(struct ZHashTable *hash_table);
6969
// set key to val (if there is already a value, overwrite it)
7070
void zhash_set(struct ZHashTable *hash_table, char *key, void *val);
7171

72-
// get the value stored at key (if no value, then return NULL)
72+
// get the value stored at key (if no value, return NULL)
7373
void *zhash_get(struct ZHashTable *hash_table, char *key);
7474

75-
// delete the entry stored at key and return the value
75+
// delete entry stored at key and return the value (if no value, return NULL)
7676
void *zhash_delete(struct ZHashTable *hash_table, char *key);
7777

7878
// return true if there is a value stored at the key and false otherwise
@@ -110,7 +110,7 @@ int main ()
110110
for (iterator = zcreate_iterator(hash_table);
111111
ziterator_exists(iterator); ziterator_next(iterator)) {
112112
113-
printf("%s %s\n", (char *) ziterator_get_key(iterator),
113+
printf("%s %s\n", ziterator_get_key(iterator),
114114
(char *) ziterator_get_val(iterator));
115115
}
116116
@@ -132,7 +132,7 @@ void *zsorted_hash_get(struct ZSortedHashTable *hash_table, char *key);
132132
void *zsorted_hash_delete(struct ZSortedHashTable *hash_table, char *key);
133133
bool zsorted_hash_exists(struct ZSortedHashTable *hash_table, char *key);
134134

135-
// create iterator to be used in iteration functions below
135+
// create an iterator to be used in iteration functions below
136136
struct ZIterator *zcreate_iterator(struct ZSortedHashTable *hash_table);
137137

138138
// free iterator

examples/sorted_hello.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int main ()
1616
for (iterator = zcreate_iterator(hash_table);
1717
ziterator_exists(iterator); ziterator_next(iterator)) {
1818

19-
printf("%s %s\n", (char *) ziterator_get_key(iterator),
19+
printf("%s %s\n", ziterator_get_key(iterator),
2020
(char *) ziterator_get_val(iterator));
2121
}
2222

0 commit comments

Comments
 (0)