C Notes
#include <stdio.h> #include <string.h> int main(void) { char f[] = "++++"; char c; char m[11]; int i; int o_size = 4; int i_size = 1; scanf("%c", &c); memset(m, c, 10); m[10] = 0; for (i = 0; i < 5; i++) { printf("%.*s%.*s%.*s\n", o_size, f, i_size, m, o_size, f); o_size -= 1; i_size += 2; } return 0; } e.g.: ends_with(filename, ".pdf.epub.mobi"); int ends_with(const char *string, const char *tail) { const char *s1; const char *s2; if (!*tail) return 1; if (!*string) return 0; for (s1 = string; *s1; ++s1); for (s2 = tail; *s2; ++s2); if (s1 - string < s2 - tail) return 0; while (*--s1 == *--s2) { if (s2 == tail) return 1; } return 0; } faster bsearch: int monobound_bsearch(uint8_t *key, Digest_t **array, size_t nmemb, size_t size, int (*cmp)(const void *, const void *)) { size_t mid, top, p