Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
822 B
1
Indexable
Never
#include <iostream>

using namespace std;

int copy(int n, int *tab1)
{
	int count = 0;
	int k = 0;
	for (int j = 0; j < n; j++) if (tab1[j] = !0) count++;
	int* tab2 = new int[count];
	for (int i = 0; i < n; i++) if (tab1[i] = !0) tab2[k] = tab1[i]; k++;
	return *tab2;
}

int main()
{
	int n = 7;
	int* tab1 = new int[n];
	for (int i = 0; i < n; i++) tab1[i] = i;
	cout << copy(n, tab1);
}#include <iostream>

using namespace std;

int copy(int n, int *tab1)
{
	int count = 0;
	int k = 0;
	for (int j = 0; j < n; j++) if (tab1[j] = !0) count++;
	int* tab2 = new int[count];
	for (int i = 0; i < n; i++) if (tab1[i] = !0) tab2[k] = tab1[i]; k++;
	return *tab2;
}

int main()
{
	int n = 7;
	int* tab1 = new int[n];
	for (int i = 0; i < n; i++) tab1[i] = i;
	cout << copy(n, tab1);
}