Skip to content

Commit

Permalink
merge_sort.c: Fix stack smashing error
Browse files Browse the repository at this point in the history
  • Loading branch information
sangamcse committed Oct 2, 2019
1 parent cda3426 commit 967f5a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
16 changes: 8 additions & 8 deletions .misc/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ echo "Testing C files..."
for i in $(find . -name *.c -print | sort --unique); do
echo " Compiling $i - gcc $i -lm -std=c11"
gcc $i -lm -std=c11
echo " Running $i - ./a.out > /dev/null"
./a.out > /dev/null
echo " Running $i - ./a.out 2> /dev/null"
./a.out 2> /dev/null
rm -f a.out
echo ""
done
Expand All @@ -16,8 +16,8 @@ echo "Testing C++ files..."
for i in $(find . -name *.cpp -print | sort --unique); do
echo " Compiling $i - g++ $i -lm -pthread -std=c++11"
g++ $i -lm -pthread -std=c++11
echo " Running $i - ./a.out > /dev/null"
./a.out > /dev/null
echo " Running $i - ./a.out 2> /dev/null"
./a.out 2> /dev/null
rm -f a.out
echo ""
done
Expand All @@ -29,15 +29,15 @@ for i in $(find . -name *.java -print | sort --unique); do
javac -Werror -Xlint:all $i -d .
filename="${i##*/}"
classname="${filename%.*}"
echo " Running $i - java $classname > /dev/null"
java $classname > /dev/null
echo " Running $i - java $classname 2> /dev/null"
java $classname 2> /dev/null
echo ""
done
rm -f *.class

echo "Testing Python files..."
for i in $(find . -name *.py -print | sort --unique); do
echo " Running $i - python3 $i > /dev/null"
python3 $i > /dev/null
echo " Running $i - python3 $i 2> /dev/null"
python3 $i 2> /dev/null
echo ""
done
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
branches:
- master
git:
depth: 1
sudo: false
dist: xenial
dist: bionic
language: python
python: 3.7

Expand Down
2 changes: 1 addition & 1 deletion merge_sort/C/merge_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void merge(int[], int, int, int);

int main() {
int arr_size = 6;
int arr[6] = {10, 9, 8, 7, 6, 5};
int arr[] = {10, 9, 8, 7, 6, 5};
mergesort(arr, 0, arr_size);

// Print sorted array
Expand Down

0 comments on commit 967f5a1

Please sign in to comment.