Description
1. Like some other languages, a variable of Turbo C must first define its data type before it can be used, and undefined variables cannot be used. The definition variable type should precede the executable statement, as the first statement in the previous example main () function is the variable definition statement, which must precede the first execution statement CLRSCR ().
2. In Turbo C, large and lowercase letters are distinguished, and the large and lowercase characters of the same letter represent different variables.
3. Turbo C Program Writing format is very flexible, there is no strict restrictions.
The main function of Example 1 can be written as:
Main () {char C; clrscr (); Gotoxy (12,3);
Puts ("Welcome to use Turbo c2.0!"); Gotoxy (15,13);
printf ("<cr>--continue"); Gotoxy (15,15);.}
There is no error in this syntax, but it is inconvenient to read, but also makes the program level ambiguous. The author suggests that when programming with Turbo C, a line of statements is encountered, the nested statement is indented backwards, and the program is annotated as necessary. This will make the program structure clear, easy to read, maintain and modify.
Through the above introduction, we can get the general form of Turbo C source program is:
Include file
Child function Type description
Definition of whole variable
Main ()
{
Local variable definition
< program body >
}
Sub1 ()
{
Local variable definition
< program body >
}
SUB2 ()
{
Local variable definition
< program body >
}
.
.
.
SUBN ()
{
Local variable definition
< program body >
}
where Sub1 (), ..., Subn () represents a user-defined child function, the program body refers to any library function call statements, control flow statements, or other call statements with child functions provided by Turbo C 2.0.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.