#include<stdio.h> #include <ctype.h> #include <stdbool.h> bool test_extension(const char *file_name, const char *extension); int main() { const char *file_name = "memo.txt"; const char *extension = "TXT"; test_extension(file_name, extension); } bool test_extension(const char *file_name, const char *extension) { const char *s; s = file_name; int n =0; for(;*s != '.';s++){ } s++; for(;tolower(*s)==tolower(*extension);s++,extension++) { if(*s) n++; } if(n==3) printf("true"); else printf("false"); }