Structure of the C-program 2/2Structure of the C-program 2/2

Let's continue with our first program:

c

Main.c

printf

printf() is a function that prints something to the screen, in our case, the text "Hello, c<>definity!". The text must be enclosed in double quotes, for example:

Control characters

Note

The C language treats \n as one character, not two ("\" and "n").

The \n character means the end of the line. That is, everything after this character in the text field will be transferred to the next line:

c

Main.c

In our course, we will sometimes use the \t (tabulation) character, which means a tab - 4 spaces.

c

Main.c

Semicolon (;)

; - the character of the end of the expression. Every expression in C must end with a ;. It can be compared to a dot at the end of a sentence.

Return

return - is a return statement. The C standard requires the main function to behave this way (return 0). This has a practical use on UNIX systems, but in this case, it is a statement of the "Exit status". In simple terms, the program ends with this statement. The return statement will be covered in more detail later in this course.

Everything was clear?

Section 1. Chapter 3