From 485d1b2bb8905639cb4436c59c3f22988197e882 Mon Sep 17 00:00:00 2001 From: Vaibhav Gupta Date: Tue, 2 Oct 2018 17:05:25 +0530 Subject: [PATCH] solve bus-error (core dumped), run-time error - Run time error on linux. - 'n' is declared but not initialized, neither its value is taken from user. - 'n' contains garbage value, thus throws run time error. --- Sorting/Insertion Sort.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sorting/Insertion Sort.cpp b/Sorting/Insertion Sort.cpp index 45e860dde..aca8d228f 100644 --- a/Sorting/Insertion Sort.cpp +++ b/Sorting/Insertion Sort.cpp @@ -6,8 +6,10 @@ using namespace std; int main() { int n; + cout<<"Enter the number of elements in your array: "; + cin>>n; int Array[n]; - cout<<"\nEnter any 6 Numbers for Unsorted Array : "; + cout<<"\nEnter any "<