tonnytg / 42_push_swap Goto Github PK
View Code? Open in Web Editor NEWPush Swap print some instructions to sort integers
Push Swap print some instructions to sort integers
when receive input with negative numbers, program return Error because check_values understand -1 argv[0][0] = - it is not a number
some functions don't have unity test
exec: valgrind ./push_swap 2 1 3
received:
==6637== Memcheck, a memory error detector
==6637== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6637== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==6637== Command: ./push_swap 2 1 3
==6637==
==6637== Invalid read of size 8
==6637== at 0x40153C: pop_void (push_swap_utils.c:80)
==6637== by 0x401A4B: sort_p_void (ft_sort_utils.c:116)
==6637== by 0x401AF4: ft_sort_void (ft_sort.c:26)
==6637== by 0x4016B3: push_swap (push_swap.c:31)
==6637== by 0x401C21: main (main.c:24)
==6637== Address 0x4a4d058 is 0 bytes after a block of size 24 alloc'd
==6637== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==6637== by 0x401287: new_array_void (array_utils.c:43)
==6637== by 0x40163F: push_swap (push_swap.c:22)
==6637== by 0x401C21: main (main.c:24)
==6637==
pb
sa
==6637==
==6637== HEAP SUMMARY:
==6637== in use at exit: 4 bytes in 1 blocks
==6637== total heap usage: 6 allocs, 5 frees, 64 bytes allocated
==6637==
==6637== LEAK SUMMARY:
==6637== definitely lost: 4 bytes in 1 blocks
==6637== indirectly lost: 0 bytes in 0 blocks
==6637== possibly lost: 0 bytes in 0 blocks
==6637== still reachable: 0 bytes in 0 blocks
==6637== suppressed: 0 bytes in 0 blocks
==6637== Rerun with --leak-check=full to see details of leaked memory
==6637==
==6637== For lists of detected and suppressed errors, rerun with: -s
==6637== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Validar se esse numero quebra
./push_swap 10000000000000000000000000000000000000000000000000000000000000000 3 1
What expected?
Function int sort_p_void(int total, void **array, void **swap, char c)
need get int *value_ptr with pop and save in another array with push.
What happened?
Function get only value int, save in another array losing indice
How to solve?
Refact sort_p_void to save vetor in int *value_ptr and move to another array with same indice
What I need: Sort only side A or B when make sense
Check A, Check B and mark a list to rotate, after rotate all sites, if both run with rr or rrr
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.