Closed
Conversation
Now all values bigger or less than 0 are supported as a result of comparison, previously supported results were -1, 0, 1
dnfd
reviewed
Aug 22, 2021
Comment on lines
+13
to
+21
| assert(my_strcmp("AB", "AC") < 0); | ||
| assert(my_strcmp("AB", "AA") > 0); | ||
| assert(my_strcmp("AB", "AD") < 0); | ||
| } | ||
|
|
||
| void test_long() | ||
| { | ||
| assert(my_strcmp("HELLO WORLD", "HELLA WORLD") > 0); | ||
| assert(my_strcmp("HELLO WORLD", "HELL WORLD") == 1); | ||
| assert(my_strcmp("HELLO WORLD", "HELL WORLD") > 0); |
There was a problem hiding this comment.
changing tests is not allowed unless there is a bug.
courses/cunix/ex02/src/my_strcmp.c
Outdated
| */ | ||
|
|
||
|
|
||
| int my_strcmp(char *str1, char *str2) { |
There was a problem hiding this comment.
brackets style is not consistent with other files
| { | ||
| // using malloc to allocate memory from the heap | ||
| char *str = malloc(sizeof nmb * CHAR_BIT + 1 + 1); | ||
| sprintf(str, "%d", nmb); |
courses/cunix/ex07/src/linked_list.c
Outdated
Comment on lines
22
to
25
| typedef struct node { | ||
| void *data; | ||
| struct node *next; | ||
| } node_t; |
courses/cunix/ex07/src/linked_list.c
Outdated
| } node_t; | ||
|
|
||
| // Special internal function for node creation | ||
| void *_node_create(void *data, node_t *next) |
There was a problem hiding this comment.
if it creates a node it should return a node, not a void*
courses/cunix/ex07/src/linked_list.c
Outdated
| } | ||
|
|
||
| // Removes and returns node being pointed by 'ptr' | ||
| void *list_remove(node_t **head, node_t *ptr) |
There was a problem hiding this comment.
void *list_remove(node_t **head, int pos);
Contributor
Author
There was a problem hiding this comment.
#61 Fixes the ambiguity of readme proposing one prototype, linked_list.h proposes another.
| (*fp)(curr->data); | ||
| curr = curr->next; | ||
| } | ||
| } |
There was a problem hiding this comment.
functions removing nodes do not handle free nodes, solutions contains memory leaks
courses/cunix/ex08/src/binary_tree.c
Outdated
| #include <string.h> | ||
| #include <stdio.h> | ||
|
|
||
| typedef struct node |
courses/cunix/ex08/src/binary_tree.c
Outdated
| } | ||
|
|
||
| visit_tree(node->left, fp); | ||
| (*fp)(node); |
courses/cunix/ex08/src/binary_tree.c
Outdated
|
|
||
| destroy_tree(node->left, fdestroy); | ||
| destroy_tree(node->right, fdestroy); | ||
| (*fdestroy)(node); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solutions to Week 2 tasks proposed by Nikita Sazonov