Const function in C

Viewed 9889

In the source code of git, I saw the following function definition

const char *typename(unsigned int type)
{
    if (type >= ARRAY_SIZE(object_type_strings))
        return NULL;
    return object_type_strings[type];
}

I believed that typename is a function here, but seems be to a const function, which is very confusing to me.

What does this mean and how shall one use this const function feature?

link to source cod; https://github.com/git/git/blob/7d722536dd86b5fbd0c0434bfcea5588132ee6ad/object.c#L29

1 Answers
Related