Untitled

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	int* p = NULL;
	p = (int*)malloc(n * sizeof(int));
	if (p == NULL)
	{
		cout << "Brak pamięci!!!!";
		return 1;
	}

	for (int i = 0; i < n; i++)
	{
		cout << "Podaj " << i << "-ty wyraz w tablicy: ";
		cin >> p[i];
	}
	for (int i = n - 1; i >= 0; i--)
		cout << "p[" << i << "] = " << p[i] << endl;
	free(p);
    return 0;
}