+ 1
error code
here is my code i can find reverse but get error code as below: Process finished with exit code -1073741819 (0xC0000005) int main() { int size; cin>>size; int *arr=new int(size); for(int i=0;i<size;i++){ cin>>arr[i]; } for(int i=0;i<size;i++) { cout<<arr[size-(i+1)]<<" "; } return 0; }
6 ответов
+ 3
can you include the problem plz and thx
+ 2
i also ask on stackoverflow
and i realised i have typo
int *arr=new int[size];
instead of int *arr=new int(size);
thank you for your contrubition
+ 1
entering nums and reversing array basically
for ex:
input:
3
2 5 8
output:
8 5 2
0
i got 8 5 2 for the out put
0
yes but when you give larger size it gives error code
for ex:
9
346 34 234 346 43 123 654 234 123
0
try to not add spaces
I took out the spaces and it worked