array
This commit is contained in:
parent
b21b3b8206
commit
f46e9b06d9
12
numbers.c
12
numbers.c
@ -55,6 +55,18 @@ unsigned int *createNumbers(unsigned int len)
|
||||
}
|
||||
|
||||
addToTree(numbers, duplicate->data, sizeof(int), compareFct, NULL);
|
||||
|
||||
TreeNode* treeData = nextTreeData(numbers);
|
||||
int* array = malloc(len*sizeof(int));
|
||||
array[0] = treeData->data;
|
||||
|
||||
for (int i = 1; i < len; i++)
|
||||
{
|
||||
treeData = nextTreeData(NULL);
|
||||
array[i] = treeData->data;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
// Returns only the only number in numbers which is present twice. Returns zero on errors.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user