vector segmentation fault

Posted by user1849298 on Stack Overflow See other posts from Stack Overflow or by user1849298
Published on 2012-11-24T11:03:04Z Indexed on 2012/11/24 11:03 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

I have a problem with the segmentation fault. Look:

#include<fstream>
using namespace std;
int main(){
    int n,i,vector[10001],vectorcopy[10001];
    ifstream in("program.in");
    ofstream out("program.out");
    in>>n;
    for(i=1;i<=n;i++){
        in>>vector[i];
        vectorcopy[i]=vector[i];
    }
    return 0;}

And the debugger says: Program recived signal SIGSEGV, Segmentation fault

Please, tell me what to do!

© Stack Overflow or respective owner

Related posts about c++

Related posts about vector