0

I'm new here so please don't be rude. Okay, my problem is I don't know the exact code on how you print in reverse in array.

Here's the problem:
Write a program to input a set of five numbers and print them out n the reverse order of input. Put both the input and printing in loops.

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by Narue
0

I'm new here so please don't be rude.

I fail to see the logic here. Why would be we rude? Why would your being new change that? Now for the kicker: if you know the answer to both of those questions, you're not so new as to avoid the rudeness that new people would be spared because you understand the action that prompts rudeness and still did it anyway. Otherwise you wouldn't feel the need to claim being new for the purpose of avoiding rude responses.

my problem is I don't know the exact code on how you print in reverse in array.

Given an array a of int with size n :

int i;

for (i = n - 1; i >= 0; i--)
    printf("%d\n", a[i]);

The process is identical to printing the array normally, except with an index that descends from n-1 to 0.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.