Question: I am trying to create code, that takes a file and places the contents into an array A. I am working in pieces and right

I am trying to create code, that takes a file and places the contents into an array A. I am working in pieces and right now, my program is giving me a segmentation fault. Does anyone know why this is happening or how i can fix this?

Thanks

#include #include #include #include #include #include using namespace std;

int getInvCount(vector B, int n) { int invCount = 0; for(int i=0; i < n-1; i++) { for(int j = j+1; j < n; j++) { if (B[i] > B[j]) { invCount++; } } } return invCount; }

int main(int argc, char * argv[]) {

int counter = 0; vector A; string filename; ifstream inFile; filename = argv[1];

int n = sizeof(A) / sizeof(A[0]); cout << "Output: " << endl;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!