Skip to content

Instantly share code, notes, and snippets.

@goctave
Created April 17, 2012 02:09
Show Gist options
  • Save goctave/2402930 to your computer and use it in GitHub Desktop.
Save goctave/2402930 to your computer and use it in GitHub Desktop.
CareerCup 1.2
#include <stdio.h>
#include <string.h>
void exchange(char str[])
{
int len = strlen(str);
char *beg, *end;
char temp;
beg = str;
end = str + len - 1;
while(beg < end)
{
temp = *beg;
*beg = *end;
*end = temp;
beg++;
end--;
}
}
int main()
{
char str[100];
scanf("%s", str);
exchange(str);
printf("%s\n", str);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment