0
I wrote a code to print the components of a array in reverse order. However, it only returns 5 or 6 numbers (at most), even if I have put more numbers in it.
#include <iostream>
using namespace std;
int main()
{
int i;
int vet[i];
cin >> i; /*Tamanho do array*/
for(int t = 0; t<i; t++) /*Adiciona coisas no array*/
{
cin >> vet[t];
}
for(int f = i-1; f>=0; f--) /*Imprime o que tem dentro do array em ordem inversa*/
{
cout << vet[f] << " ";
}
}
Is there anything missing?
Can you print an example? I think the code is correct.
– João Victor