Created
October 1, 2014 08:13
-
-
Save opklnm102/549af867ffa0d39bedb0 to your computer and use it in GitHub Desktop.
software global project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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