You are not defining a size for the a[] array, thus the error message. Arrays must have a size specified. In your case, you need to use the new[] operator to allocate the array after you determine that size from the user, eg:
#include <iostream>
int main() {
int *a;
int b;
std::cin >> b;
a = new int[b];
for(int i = 0; i < b; ++i)
std::cin >> a[i];
for(int c = b - 1; c >= 0; --c)
std::cout << a[c] << std::endl;
delete[] a;
return 0;
}
However, the preferred way to use a dynamically sized array in C++ is to use the standard std::vector container instead, eg:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
int main() {
std::vector<int> a;
int b;
std::cin >> b;
a.reserve(b);
std::copy_n(
std::istream_iterator<int>(std::cin), n,
std::back_inserter(a)
);
std::for_each(a.rbegin(), a.rend(),
[](int i){ std::cout << i << std::endl; }
);
/* alternatively:
std::reverse(a.begin(), a.end());
for(int i : a)
std::cout << i << std::endl;
*/
return 0;
}