Skip to content

Instantly share code, notes, and snippets.

@6uclz1
Created October 26, 2015 14:27
Show Gist options
  • Save 6uclz1/6903c1a9d105305e82ba to your computer and use it in GitHub Desktop.
Save 6uclz1/6903c1a9d105305e82ba to your computer and use it in GitHub Desktop.
//mondai2
#include <stdio.h>
#include <string.h>
void reverse(char[]);
int main()
{
char name[20];
printf("%s", "? ");
scanf("%s", name);
reverse(name);
printf("%s\n", name);
}
void reverse(char name[])
{
int i;
char tmp;
int str = strlen(name);
for(i = 0; i < str/2; i++) {
tmp = name[i];
name[i] = name[str-1-i] ;
name[str-1-i] = tmp;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment