creating array and giving error

I have been looking and i'm stuck on this. I wrote this program to find quarks and their charge and mass but i need it to give me 5 different ones. so i made an array but when i run it it gives me this
"Unhandled exception at 0x001631c6 in DiasQuarkP1V0.exe: 0xC0000005: Access violation reading location 0xd5bf0c38." and it shows the xstring library.

this is my main, is their anything wrong with my code?

#include "StdAfx.h"
#include <stdio.h>
#include <string>
using namespace std;

int main()

Quark solution[5]={};

for(int i=1;i<6;i++)
cout << "Flavor: " << solution[i].getName()<<endl;
cout << "Charge:" << solution[i].getCharge()<<endl;
cout << "Mass:" << solution[i].getMass()<<endl<<endl;


return 0;
You need to loop from i=0 to i<5. Valid array indices for an array of 5 elements are 0, 1, 2, 3, and 4.
Topic archived. No new replies allowed.