Linear table Inversion

Source: Internet
Author: User


A sequential table of length n is established, then the data elements in the table are reversed, and the original data element sequence in the even if Table is (A0,a1,a2,...,an), then the inverse data element sequence is (AN,AN-1,AN-2,...,A1,A0). (data type is character type)

Description

The length of the first behavior order table n;
The data elements in the second Behavior Order table;

Input

Sequential table with output as inverse

Output
1 2 3 7 A B C D E F G
Sample Input
1 G F E D C B A
Sample Output

#include <stdio.h>

int main ()
{
int total;
scanf ("%d", &total);
GetChar ();
Char str[10010];
int i;
for (i=0;i<total;i++)
{
scanf ("%c", &str[i]);//Why is it correct to change the input to%s?
GetChar ();
}
for (i=total-1;i>=0;i--)
{
if (i==0)
printf ("%c", Str[i]);
Else
printf ("%c", Str[i]);
}
return 0;
}

Linear table Inversion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.