mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-05 03:29:46 +08:00
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.
This commit is contained in:
@@ -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 "<<n<<" Numbers for Unsorted Array : ";
|
||||
|
||||
//Input
|
||||
for(int i=0; i<n; i++)
|
||||
|
||||
Reference in New Issue
Block a user