copy integers from linked list to new array

how to copy found integers from linked list to new array?
What do you mean by "found" integers?

How do you know the size of the new array? A compile-time constant?

See std::copy_if:
http://www.cplusplus.com/reference/algorithm/copy_if/
Does it has to be an array. Cant be a dynamic size vector?

Do you want sommething like this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

int found = 0;
	

	if (linkedlist == Match) {
		
		found++;
	}

	int *ar = new int[found];

	ar[0] = Match1;
	ar[1] = Match2;
	ar[2] = Match3;
	ar[3] = Match4;
	ar[4] = Match5;

//etc

Topic archived. No new replies allowed.