1
0
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-12-11 00:21:24 +01:00

feat(solutions): add prefix-suffix/c/function

This commit is contained in:
Divlo
2021-12-02 15:25:38 +01:00
parent ab09295fca
commit eb6e11ab5f
8 changed files with 138 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "input.h"
#include "string.h"
int main() {
char* string = input();
char* string2 = input();
bool is_preffix = string_starts_with(string, string2);
bool is_suffix = string_ends_with(string, string2);
free(string);
free(string2);
printf("%s\n", is_preffix ? "true" : "false");
printf("%s\n", is_suffix ? "true" : "false");
return EXIT_SUCCESS;
}