We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第六章 哈希表->哈希冲突->链式地址 在hash_map_chaining.c添加操作'void put(HashMapChaining *hashMap, int key, const char *val)'函数中, 在执行strcpy(newPair->val, val)操作之前没有申请内存给newPair->val。
strcpy(newPair->val, val)
newPair->val
在执行strcpy(cur->pair->val, val)之前如果新的val长度大于cur->pair->val也应该需要申请内存。
strcpy(cur->pair->val, val)
val
cur->pair->val
The text was updated successfully, but these errors were encountered:
hash_map_chaining.c
newPair->val的类型是数组,在newPair时已经分配空间,不在需要对newPair->val使用 malloc 分配空间
newPair
malloc
可以使用 sizeof(struct Pair)验证一下。
sizeof(struct Pair)
Sorry, something went wrong.
No branches or pull requests
第六章 哈希表->哈希冲突->链式地址
在hash_map_chaining.c添加操作'void put(HashMapChaining *hashMap, int key, const char *val)'函数中,
在执行
strcpy(newPair->val, val)
操作之前没有申请内存给newPair->val
。在执行
strcpy(cur->pair->val, val)
之前如果新的val
长度大于cur->pair->val
也应该需要申请内存。The text was updated successfully, but these errors were encountered: