Exemplo n.º 1
0
int MBnext_k_permutation(int *ar, int n, int k) {
    int result = MBnext_permutation(ar, k);
    if (result == 0) {
        result = MBnext_combination(ar, n, k);
    }
    return result;
}
Exemplo n.º 2
0
int main(void)
{
	unsigned int numbers[] = {0, 1, 2};
	const size_t k = sizeof(numbers) / sizeof(unsigned int);
	unsigned int n = 5;

	do {
		MBprint_array(numbers, k, stdout);
		putchar('\n');
	} while (MBnext_combination(numbers, n, k));

	return 0;
}