[Solved] in the c++ hacker rank preperation cause, the last index returns 0 when i reverse it. but when i try the code out in visual studio, it works perfectly [closed]
As mentioned in the comments, array should be initialized with a proper capacity. You should first read the size and then create the array. #include <iostream> using namespace std; int main() { int n; // First read the array size and then create the array. cin>>n; //inputting the array size int array[n]; //inputting the numbers … Read more