We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
int*arrPtr{},userInput{};cin>>userInput;arrPtr=newint[userInput];//allocate array at runtimefor(size_ti{1};i<=userInput;i++){cin>>arrPtr[i-1];//store elements starting at index 0}for(size_tj{1};j<=userInput;j++){cout<<arrPtr[userInput-j]<<" ";}delete[]arrPtr;//free allocated storage (good practice)
//Pre-defined array with a fixed size (based on constraints)
Arrays Introduction
You are viewing a single comment's thread. Return to all comments →
//Dynamic allocation of an array
//Pre-defined array with a fixed size (based on constraints)