Dynamic Progamming

I am getting "Access violation reading location 0x029C4010."error while running this program though It does not show any errors.
What is wrong with this? thanks for looking into it.
ifstream myfile;

Last edited on
Use code tags http://www.cplusplus.com/articles/z13hAqkS/

Using GDB debugger the segfault occurs @ A[i] = name;
Adding a watch to i shows us that i = 1000000;
Are you sure the magic number is enough? Would it not be neater to use std::vector, which has push_back()?

Are you sure that all of the myfile>>name>>V[i]>>S[i]; succeeds every time?

Why do you read into char array instead of std::string?

The A, V, S together could be a struct?

Edit: "Dynamic programming"?
Last edited on
Thanks. I used a vector instead of array.
Topic archived. No new replies allowed.