#include <stdio.h>
int i;
for (i = 0; i < 5; i++)
{
add (records, strings[i], numbers[i], i);
printf("name %s and age %d\n", records[i].string, records[i].number);
}
You don't have SIZE strings, you only have 5: "xxx", "yyy", "zzz", "aaaa", "bbb".
After the "for()" loop, the value of i is SIZE in you case. Then you try to use i as an index in the records vector. Which is an out of bounds error. The records vector has SIZE indexes: 0, 1, 2, ..., SIZE-1; but you try to print a record that is outside the vector. record[i].string = record[SIZE].string = nasty error.