I'm using Qt creator and I swear I've seen it display static array elements before. I don't recall updating the IDE, the compiler, the debugger or anything else, so I'm not sure what's going on. I've tried the two ways I know to display array elements and none of them seem to be working.
I have a struct like this:
struct Student
{
int id;
string name;
string email;
long int phone;
};
and then a static array like this:
Student students[100];
which I'm populating with test data in this function:
void populateStudents(Student students[], int &size)
{
students[0]={14562, "Bill Stewart", "", 56723565};
students[1]={12684, "Joan Murray", "", 43560056};
students[2]={13118, "Alex Taylor", "", 64223053};
students[3]={11902, "Pamela Brandon", "", 74534230};
size=4;
}
So I also have this function to find a specific item in the array:
string findName(Student students[], int size, int id){
for (int i=0; i!=size; i++){
if (students[i].id==id)
return students[i].name;
}
return "";
}
and I'm exploring the data while it's being executed, but I've tried adding "@10" to the expression evaluator to show the first 10 items in the array, but I only get the first one displayed and some of the items show up as pointers...
Also tried adding a new expression evaluator like this: Student[10]students (class name[items I want to view]variable name) but this time it doesn't even recognize my array:
Of course, the data is correctly stored in the array and the program is working fine, only the debugger is not showing the data correctly.
I recall using both methods in the past and seeing them work... What am I missing here? These are my debugging settings: