10

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.

  • 9
    Typical usage is to use the determiner or elide both the article and the word function: "I call the printf function" or simply "I call printf". – Dan Bron May 20 '15 at 16:45
23

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.

  • 2
    I like your aside about the possibility of having multiple printf functions available. Covers all the bases! – FumbleFingers Reinstate Monica May 20 '15 at 17:31
  • 3
    It should probably be noted that even though printf is a proper noun, the rules about capitalization of proper nouns generally don't apply. Particularly if you're discussing a case-sensitive language. – cHao May 21 '15 at 6:33
  • Great answer, grammatically, but from the point of computer programming you should always include parenthesis when talking about functions -- since no function is complete without them! So even more correct than anything above is "I called the printf() function." – Dave Kanter May 21 '15 at 11:03
  • ...oh and "I called printf()" would be a more informal use. But you could say something like "This clearly calls for printf()." – Dave Kanter May 21 '15 at 11:05
  • 4
    I disagree with "you should always include parenthesis when talking about functions". You're talking about the function itself, not the invocation of it. In fact, printf() isn't even valid code, so what value are the parentheses adding? The name of the function is printf. Its name is not printf(). – Isvara May 21 '15 at 15:51
7

The preferred and most common usage is simply "Here I call printf." A construct like "Here I call the printf function" is needlessly verbose. The exception is when the word printf would appear at the beginning of a sentence. It cannot be capitalized because its case is part of its correct spelling, and leaving it uncapitalized is typographically awkward.

  • Or possibly if you're writing for a non-programmer audience, where you need to make it clear that printf IS a function. – jamesqf May 20 '15 at 18:52
  • @jamesqf: In that case, I believe the phrasing "Here I call the function printf." would best achieve clarity, conciseness, and description. – Pieter Geerkens May 21 '15 at 3:35
2

'the' should be used with printf because we are talking about a particular command. We should use 'the' when pointing to a specific thing.

Here I call the printf function

is correct usage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.