Giter VIP home page Giter VIP logo

push_swap's Introduction

push_swap

This program is used to sort a list of unorganized numbers into a stack, using a limited set of instructions. The challenge lies behind using the lowest possible number of actions to achieve an optimized sorting.

push_swap's People

Contributors

yasmineww avatar yassssmine avatar

Watchers

 avatar

push_swap's Issues

Compiling Error In non-void function 'check_sort' should return a value !

cc -Wall -Wextra -Werror -c parsing.c
parsing.c:71:3: error: non-void function 'check_sort' should return a value [-Wreturn-type]
                return ;
                ^
1 error generated.
make: *** [parsing.o] Error 1
File: Paring.c
Line: 72
72	if (!stack_a || !(*stack_a))
73		return ;

Simple Solution:

This Function should return an int value to ignore Flags

72	if (!stack_a || !(*stack_a))
73		return (0);

The Advanced & Crazy Solution is:

#pragma GCC diagnostic ignored "-Wreturn-type"

this preprocessor should ignore the -Wreturn-type Warning During the compilation diago mechanism

#pragma GCC diagnostic push // Recommended
#pragma GCC diagnostic ignored "-Wreturn-type" // important to ignore the warning
int	check_sort(t_list **stack_a)
{
	t_list	*node1;
	t_list	*node2;

	if (!stack_a || !(*stack_a))
		return ;
	node1 = *stack_a;
	while (node1->next != NULL)
	{
		node2 = node1->next;
		while (node2 != NULL)
		{
			if (node1->content > node2->content)
				return (1);
			node2 = node2->next;
		}
		node1 = node1->next;
	}
	return (0);
}
#pragma GCC diagnostic pop // Recommended if u push a label in the start, use pop to close it
Details

More info

Good Project Keep going... ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.