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
Algorithmization and programming. Structural programming. C language
Terms: Algorithmization and programming. Structural programming. C language