The basic course of C language (VI) Turbo C programming Preliminary (4)

Source: Internet
Author: User
Below we try to build a turbo C named "HELLO." C "source program (because the program is very small, here will not draw the outline of the program):
1. Operation Steps:
(1). Place the system at a DOS prompt:
(2). Type the command:
TC HELLO.C
Bring the system into the Turbo C integrated development environment and create a file called hello.c. At this time, the system into the Turbo C editing environment.
(3). Enter the program through the keyboard, for example:
Main ()
{
printf ("Hello, world\n");
}
The program goes into the computer memory.
2. Program Save
In order to prevent accidental loss of the program, it is best to store the input program to disk. Under the editing window, you can press the F2 key or press the F10 key, press the F key to enter the File menu item, and then press S or W key to save the file. The bottom line of the screen appears when you save the disk:
"Saving Edit File"
3. Compile a program
There are two ways to compile a source program: (1). Press ALT+F9 directly. (2). Press F10 key to return to main menu, select Compile item, screen display compile Drop-down menu, select Compile to from Pull-down menu. Obj entry, press ENTER.
After entering the compile State, a compilation window appears, and after a few seconds, the screen displays a flashing message:
Success:press any key
Indicates that the compilation was successful. At this point, you can press any key, the compiler window disappears, the cursor returns to the main menu.
If a warning warning or error message is generated at compile time, these specific error messages are displayed in the information window at the bottom of the screen and must be corrected. Modify the source program to compile again.
4. Run the program
After the source program is compiled correctly, it can be put into operation. The specific actions are as follows:
(1). If you are still editing the state, you can press ALT+R, and then select the Run item.
(2). Press CTRL+F9.
When the program is put into operation, a connection window appears, displaying the library functions that turbo C is connecting to and the program requires. After the connection, there will be a sudden flash of the screen, and then back to TC main screen, what happened? Let's press ALT+F5 to see if the screen is cleared and the words "Hello, world" are displayed at the top. Press any key again, can return to TC main screen again.
5. column Disk File directory
Now press Alt+x to exit Turbo C, return to the DOS prompt, type dir hello.*, enter, and the screen displays:
HELLO C 42 1-09-93 10:18
HELLO OBJ 221 1-09-93 10:22
HELLO EXE 4486 1-09-93 10:25
...
The first file hello.c is the source file text, type HELLO at the DOS prompt. The C command, which displays the contents of the file on the screen. You can see that the program is only 42 bytes.
The second file hello.obj is the binary machine instruction (target code) generated by the Turbo C optional program, and if the file is displayed with the DOS command type, the screen may appear to have confusing information.
The third file HELLO.EXE is the actual executable file produced by the Turbo C connector. At the DOS prompt, type Hello and press ENTER, and the screen will display "Hello,world".
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.