Array Values

Could anyone explain why this returns -2??

#include <iostream>

using namespace std;

int main()
{

int a,b,c,d,e = 3;
int billy[5] = {a,b,c,d,e};

cin.ignore();
cout<< a <<"\n";
cin.get();
}
It could output any number at all, since a is not initialised.

Only e and billy[4] have a known value of 3. The other variables contain whatever happens to already be in those memory locations, usually referred to as 'garbage'.
Topic archived. No new replies allowed.