Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

金浩 #44

Open
shencang opened this issue Dec 3, 2016 · 0 comments
Open

金浩 #44

shencang opened this issue Dec 3, 2016 · 0 comments

Comments

@shencang
Copy link

shencang commented Dec 3, 2016

字符串倒序输出

#include<stdio.h>
#include<string.h>


  void reverse(char *);
main()
{
  
    char s[2500];
    gets(s);
    reverse(s);
    printf("%s\n",s);

	return 0;
}


void reverse(char *s)
{
    int i, j;

    int c;
     
    for (i = 0,j = strlen(s) - 1; i < j; i++, j--) {
        c = s[i];
        s[i] = s[j];
        s[j] = c;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant