1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

feat(solutions): add is-palindrome/c/function

This commit is contained in:
Divlo
2021-09-28 23:58:00 +02:00
parent 96ca014afd
commit a6bd36b754
15 changed files with 186 additions and 6 deletions

View File

@ -0,0 +1,18 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "character.h"
#include "input.h"
#include "string.h"
int main() {
char* string = input();
string = string_to_upper(string);
string = string_replace(string, ' ', '\0');
bool is_palindrome = string_is_palindrome(string);
free(string);
printf("%s\n", is_palindrome ? "true" : "false");
return EXIT_SUCCESS;
}