You get a bonus - 1 coin for daily activity. Now you have 1 coin

8.2. The structure of a simple program in the C language.

Lecture



A program written in C consists of a set of functions, one of which is the function main () . () means that main is a function, but does not mean that it has no arguments. The function description consists of the header and the body of the function. The header contains preprocessor statements, for example, the #include directive, which is a standard part of all C programmatic compilers. This file contains information about input / output statements.
The body of the function is enclosed in curly brackets and consists of a series of operators, each of which ends with a " ; ".
Example:
#include int main (void) / * simple program * /
{
int num; / * define a variable named num * /
num = 1; / * assign the value num to the variable * /
printf ("I'm simple");
printf ("computer");
printf ("My favorite number is% d, because it is ...", num);
return 0;
}
The result of the program execution will be a message on the screen:
I am a simple computer. My favorite number is 1 because it is ...


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Algorithmization and programming. Structural programming. C language

Terms: Algorithmization and programming. Structural programming. C language