Skip to content

add_polynomials.c : added a function for tidy up the heap.#3501

Open
christianbender wants to merge 3 commits intoOpenGenus:masterfrom
christianbender:changed_add_polynomials_C
Open

add_polynomials.c : added a function for tidy up the heap.#3501
christianbender wants to merge 3 commits intoOpenGenus:masterfrom
christianbender:changed_add_polynomials_C

Conversation

@christianbender
Copy link

Changes:

  • Added a function free_poly(...) for tidy up the heap.

*/
void
create_node(int x, int y, struct Node **temp)
void create_node(int x, int y, struct Node **temp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The older version was correct; The C style guide says the type goes on its own line.


void free_poly(struct Node * poly)
{
struct Node* tmp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* should be attached to variable, not type.

{
struct Node* tmp;
while(poly)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces go with the keyword.

void free_poly(struct Node * poly)
{
struct Node* tmp;
while(poly)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space before (.

struct Node* tmp;
while(poly)
{
tmp = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just move the declaration in here to limit the variable scope.

free_poly(poly1);
free_poly(poly2);

return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the parentheses. C style guide.

@christianbender
Copy link
Author

@arnavb Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants