Hi,
I searched the forum and found "Watches Expansion of structures" but that did not supply a solution to my current problem.
Basically I have not yet found out how to display the field contents in the second and further structs in a block of structs.
I have entered the variable name of a struct variable in the leftmost/bottommost field of the Watches window, right-clicked on the field and selected dereference pointer. I have also (left)clicked on the rightward pointing small black arrowhead which has displayed the field contents of the first struct in the block of structs. However I am at a loss as to how to display the field contents of the second and subsequent structs in the Watches window. For example, at the appropriate point, the Watches window shows that two records (i.e. structs) have been created but the Watches window still shows the field contents of the first struct. Could you please advise how to get the Watches window to display the field contents in the second and further structs ?
Above main() I have :-
typedef struct rec
{
char recordUsed;
char firstName[15];
char lastName[15];
char phoneNumber[15];
} record;
To grab a block of memory I use:-
static record * createRecords(unsigned int * ptrRecordsCreated)
{
record * ptrRecords;
size_t numberOfRecords = 5;
size_t index;
ptrRecords = calloc(numberOfRecords, sizeof(record));
if (ptrRecords == NULL) /* if memory not available ... */
{
printf("\nERROR! Out of memory!\n");
printf("\nExiting program\n");
exit (0); /* ... exit program */
}
/* Mark all records as not used */
for (index = 0; index < numberOfRecords; index++)
{
ptrRecords[index].recordUsed = 'N';
}
*ptrRecordsCreated += numberOfRecords;
return ptrRecords;
} /* end createRecord() */