Skip to content

Instantly share code, notes, and snippets.

@austa
Created March 19, 2013 13:14
Show Gist options
  • Save austa/5196010 to your computer and use it in GitHub Desktop.
Save austa/5196010 to your computer and use it in GitHub Desktop.
/*
* File: main.c
* Author: alaattin
*
* Created on 19 Mart 2013 Salı, 14:57
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
*
*/
int palindrom (char []);
int main(int argc, char** argv) {
char dizi1[] = "nazan";
printf("%d\n", palindrom(dizi1));
return (EXIT_SUCCESS);
}
int palindrom ( char dizi1 []) {
int i = 0, son = 0;
son = strlen(dizi1) - 1;
while(dizi1[i] != '\0' ) {
if(dizi1[i] == dizi1[son]){
i++;
son--;
}
else {
return 0;
}
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment