I want to fill an array from the highest index and descending order. A sample code as shown: #include <iostream> using namespace std; int main() { int myArr[5]; for(int x=4; x<1; x--) { myArr[x] = x; cout << x << ": " << myArr[x] << endl; } return 0; } Running the code shows no output, can someone explain why it doesn't work?
11/19/2016 1:56:36 PM
Kasem Chaisieng2 Answers
New AnswerOk, my condition in the for loop was wrong, that's why it's not running. Thanks boss
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message