Learn English – Using “the” with names of functions, variables, constants in computer literature

definite-article

When I write computer-related text and want to refer to something (a variable, a function, etc.) that has a unique name, should I add “the” before the name? For example: “Here I call the printf function” vs “Here I call printf function.” Logically it seems that the name is a sufficient determiner, but at the same time I see that many people use “the” here.

Best Answer

Function is a count noun, and it typically appears with a determiner of some sort:

I called a function.
I called this function.
I called the function.
I called two functions.

Lots of determiners work, as you can see above.

You can add the name of the function as an attributive modifier:

I called the printf function.

And in that case, you've made it specific, so the is probably the appropriate determiner (unless you're in an unusual situation where you have more than one printf function to discuss).

But function needs a determiner, so these are ungrammatical:

*I called function.      (ungrammatical)
*I called printf function. (ungrammatical)

By itself, printf doesn't need a determiner. It's a proper noun:

I called printf.

This is fine too, and I think it's probably more common in speech, but I don't have a corpus to check, so that's really just a guess.


In this answer, the * symbol marks an utterance as ungrammatical.

Related Topic