Skip to content

Instantly share code, notes, and snippets.

@jstaursky
Last active September 2, 2019 15:08
Show Gist options
  • Save jstaursky/71c95dffb824667582b8cca9e2250800 to your computer and use it in GitHub Desktop.
Save jstaursky/71c95dffb824667582b8cca9e2250800 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
bool palendrome (char* const word)
{
size_t len = strlen (word);
char *start = word,
*end = start + len - 1;
while (memcmp (start, end, 1) == 0 && start++ < end--)
continue;
if (start > end)
return true;
else
return false;
}
int main(int argc, char *argv[])
{
if (palendrome (argv[1]))
puts ("true");
else
puts ("false");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment