Sorting the album, only photos stay. Write is_jpg(file): return true if the name file ends with .jpg, otherwise false. Lower case only; a name shorter than 4 characters never is.
is_jpg("beach.jpg")→Trueis_jpg("notes.txt")→Falsebool is_jpg(const char *file)#include <stdbool.h>
#include <string.h>
bool is_jpg(const char *file) {
bool ok = false;
int len = strlen(file);
if (len >= 4) {
// your code here: compare ".jpg" with the string from the 4th character from the end
}
return ok;
}
Run tries the examples. When they look right, Submit.