Part 3. The Screen Output Function: Letters on the Screen – It’s Not That Simple!

So, we removed the "Hello, World!" strings from all examples to make it easier for us to analyze the program structure further. For Python and C we got the following:

Python:

print(...)

C:

#include <stdio.h>

int main() {
    printf(...);
}

We will discuss JavaScript and C++ separately, as they require more detailed explanations.

In both languages, we see very similar function names: print and printf.

The suffix f at the end of printf in the C language is an abbreviation for “formatted” — meaning the screen output can be formatted. We will talk about this later. For now, if you are writing in C, don’t forget the letter f at the end.

Wait, what are functions?

Remember our algorithm for buying kefir? — We had an instruction buy(what, where, here_is_money), behind which stood a whole sequence of actions—starting from leaving the house and ending with paying for the purchases at the checkout.

Well, print (in Python) and printf (in C) are examples of high-level instructions, or more correctly, functions. And they are structured similarly: print(what).

The parentheses here are like the “hands” of the function: we put in them what the function should work with—it’s like a note from your mom saying what exactly to buy, if we return to our kefir example.

Perhaps you haven’t thought much about what stands behind the appearance of text on your computer or smartphone screen. Well, letters are just letters. It seems straightforward.

But what are letters on a display screen?

Hello pixels

If you look closely at the image, or examine a display under a magnifying glass, you will see that each letter consists of many tiny dots (pixels).

The display knows nothing about letters; it can only draw dots in specified locations with specified colors. To draw a letter, it must be assembled from dots.

Furthermore, letters can be of different sizes and written in different fonts. And complex mathematics is applied to them (for example, cubic Bézier curves) so that letters don’t lose their display quality when scaled.

So, behind such a seemingly simple action as outputting letters to the screen lies a huge number of instructions, and they are all hidden under the short name of the function print in Python or printf in C.

Okay, we have the print function. We can call it and ask it to display the string we need:

print("Hello, World!")

Let’s summarize what we’ve learned:

  • print is a command (a function).

  • () means “execute this command”.

  • Everything inside () is information for the command.

Thus, print("Hello, World!") means execute the print command with the text "Hello, World!".