int distances[]={};
because it is doing exactly what you tell it to do; is to create and empty array.
try:
int distances[10]; //create array with 10 elements
keep in mind that in C/C++ the element starts at index 0.
int distances[]={};
because it is doing exactly what you tell it to do; is to create and empty array.
try:
int distances[10]; //create array with 10 elements
keep in mind that in C/C++ the element starts at index 0.