Skip to content

Instantly share code, notes, and snippets.

@opklnm102
Created October 1, 2014 08:13
Show Gist options
  • Save opklnm102/549af867ffa0d39bedb0 to your computer and use it in GitHub Desktop.
Save opklnm102/549af867ffa0d39bedb0 to your computer and use it in GitHub Desktop.
software global project
#include<stdio.h> //1byte의 회문(영어)
#include<string.h>
int main(int argc, char *argv[])
{
char str[80],*ps,*pe;
int res;
if(argc == 2){
strcpy(str,argv[1]);
}
else{
printf("Type the string for palindrome check : ");
gets(str);
}
ps=&str[0];
pe=ps+strlen(str)-1;
while(pe > ps){ //교차되기 전까지
if(*ps != *pe){
res=0;
break;
}
ps++; pe--;
}
if(res==0)
printf("%s is not palindrome!\n",str);
else
printf("%s is palindrome!\n",str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment