Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

@forsvarir covered most of the important points already, but I have this additional comment:

###Useless functions###

Useless functions

I found these functions to be useless:

NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}

All these functions do is return the argument passed in. I can sort of see what you were trying to do, though. You were probably trying to write functions to check if the queue/stack are empty. But those functions should return bools, not pointers:

bool is_stack_empty(const NODE *head)
{
 return head == NULL;
}
bool is_queue_empty(const QUEUE *q)
{
 return q->head == NULL;
}

@forsvarir covered most of the important points already, but I have this additional comment:

###Useless functions###

I found these functions to be useless:

NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}

All these functions do is return the argument passed in. I can sort of see what you were trying to do, though. You were probably trying to write functions to check if the queue/stack are empty. But those functions should return bools, not pointers:

bool is_stack_empty(const NODE *head)
{
 return head == NULL;
}
bool is_queue_empty(const QUEUE *q)
{
 return q->head == NULL;
}

@forsvarir covered most of the important points already, but I have this additional comment:

Useless functions

I found these functions to be useless:

NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}

All these functions do is return the argument passed in. I can sort of see what you were trying to do, though. You were probably trying to write functions to check if the queue/stack are empty. But those functions should return bools, not pointers:

bool is_stack_empty(const NODE *head)
{
 return head == NULL;
}
bool is_queue_empty(const QUEUE *q)
{
 return q->head == NULL;
}
added 14 characters in body
Source Link
JS1
  • 28.8k
  • 3
  • 41
  • 83

@forsvarir covered most of the important points already, but I have this additional comment:

###Useless functions###

I found these functions to be useless:

NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}
NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}

All these functions do is return the argument passed in. I can sort of see what you were trying to do, though. You were probably trying to write functions to check if the queue/stack are empty. But those functions should return bools, not pointers:

bool is_stack_empty(const NODE *head)
{
 return head == NULL;
}
bool is_queue_empty(const QUEUE *q)
{
 return q->head == NULL;
}

@forsvarir covered most of the important points already, but I have this additional comment:

###Useless functions###

I found these functions to be useless:

NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}

All these functions do is return the argument passed in. I can sort of see what you were trying to do, though. You were probably trying to write functions to check if the queue/stack are empty. But those functions should return bools, not pointers:

bool is_stack_empty(const NODE *head)
{
 return head == NULL;
}
bool is_queue_empty(const QUEUE *q)
{
 return q->head == NULL;
}

@forsvarir covered most of the important points already, but I have this additional comment:

###Useless functions###

I found these functions to be useless:

NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}

All these functions do is return the argument passed in. I can sort of see what you were trying to do, though. You were probably trying to write functions to check if the queue/stack are empty. But those functions should return bools, not pointers:

bool is_stack_empty(const NODE *head)
{
 return head == NULL;
}
bool is_queue_empty(const QUEUE *q)
{
 return q->head == NULL;
}
Source Link
JS1
  • 28.8k
  • 3
  • 41
  • 83

@forsvarir covered most of the important points already, but I have this additional comment:

###Useless functions###

I found these functions to be useless:

NODE *check_queue(NODE *head){
 return head;
}
NODE *check_stack(NODE *head){
 return head;
}

All these functions do is return the argument passed in. I can sort of see what you were trying to do, though. You were probably trying to write functions to check if the queue/stack are empty. But those functions should return bools, not pointers:

bool is_stack_empty(const NODE *head)
{
 return head == NULL;
}
bool is_queue_empty(const QUEUE *q)
{
 return q->head == NULL;
}
lang-c

AltStyle によって変換されたページ (->オリジナル) /