Hi there, just making a small app using an array, although it compiles and runs in the IDE(eclipse) just how i want it to, when i try run the app in a bash shell i get:
Code:
:~/workspace/Reverse Array/Release$ ./ReverseArray
Please enter a number: 1
Please enter a number: 2
Please enter a number: 3
Please enter a number: 4
Please enter a number: 5
Segmentation fault (core dumped)
here is my code:
Code:
#include<iostream>
using namespace std;
int main()
{
int nArray[5];
for(int x=0;x<5;x++)
{
cout << "\nPlease enter a number: ";
cin >> nArray[x];
}
cout << "\nYour numbers are: " << nArray[0] << nArray[1] << nArray[2] << nArray[3] << nArray[4];
return 0;
}
sorry for this question, because i know to everyone this is apparent but i just cant figure this out for some reason :S
-PS, take no notice of the app title "Reverse Array" ill change the order once this bug is fixed