c read file into string

#include <stdio.h>
#include <stdlib.h>

char readFileIntoString(const char filename) {
    FILE *file = fopen(filename, "r");
    if (file == NULL) {
        return NULL;
    }

    fseek(file, 0, SEEK_END);
    long length = ftell(file);
    fseek(file, 0, SEEK_SET);

    char content = (char )malloc(length + 1);
    if (content == NULL) {
        fclose(file);
        return NULL;
    }

    fread(content, 1, length, file);
    content[length] = '\0';

    fclose(file);
    return content;
}

int main() {
    const char *filename = "example.txt";
    char *fileContent = readFileIntoString(filename);

    if (fileContent != NULL) {
        printf("File content:\n%s\n", fileContent);
        free(fileContent);
    } else {
        printf("Error reading file.\n");
    }

    return 0;
}