It is not displaying my function

This is what the display() function should do:
Write a void function called display() to display each element of the struct at the end of the program, call display and pass it the array of structs.

When I run the program, everything works besides the display() function.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int main()
{
	int const size = 3;
	Leads names[size];

	cout << "Enter leads\n" << endl;

	for (int i = 0; i < 3; i++)
	{
		names[i] = enterLead(names[i]);	
	}

	display(names[3]);

	return 0;
}
Last edited on
Can you tell us what specifically with display() is not working?
Last edited on
When I run the program and I enter all the leads, the program stops working. Nothing from display() appears. The question, "Would you like to see only active leads? Y or N?" does not even show up. I have tried so many things but I just can't seem to get it right.
Last edited on

display(names[3]);

Hint: Your array has size 3, but you're trying to pass the 4th element into a function..

edit: also, what's the point of only passing one of your array elements to your display function?
Last edited on
That link was really helpful, thank you so much! I really appreciate it!
Topic archived. No new replies allowed.