Declaration of variables
It allows the compiler to decide how much storage space to allocate for storage of the value associated with the identifier and to assign an address for each variable which can be used in code generation.
Rules for a valid identifer or a variable name
start with a letter
consist only of letters, the digits 0-9, or the underscore symbol _
not be a reserved word
After you have written the source file for your program, you need to turn it into an executable file. This is called “Making” the .exe file
The Integrated Development System:
Turbo C features an integrated development environment or IDE. It is also referred as Programmer’s Platform. It is a screen display with windows and pull down menus. The program listing, its output, error messages and other information are displayed in separate windows.
You use menu selections or key combinations to invoke all the operations necessary to develop your program, including editing, compiling, linking, and program execution. You can even debug your program within IDE.
The Command-Line Development System:
Files used in C Program Development:
- Executable Files
- Library and Run Time Files
- Header Files
- Programmer Generated Files
These files are stored in the sub-directory BIN. The most important executable at least is TC.EXE. Executing this program loads the IDE on your screen. BIN directory also contains programs for the command line development process previously a bit discussed and utility programs for use in specialized situations. Here are some of them as follows.
- TCC: Command-Line Compiler
- TLINK: Command-Line Linker
- MAKE: File Management Program
- GREP: searches for strings in groups of files
- TOUCH: updates file date and time
- CPP: Preprocessor utility
- TCINIST: customizes Turbo IDE.
- TLIB: Library File Manager
- UNZIP: unpacks ZIP (compressed) files
- OBJXREF: object file cross-reference utility
- THELP: popup utility to access help file
Various files are combined with your program during linking. These files contains routines for a wide variety of purposes. These are library files, run-time object files, and math library files. They are all stored in LIB directory.
If you are using floating point arithmetic in your programs you will need another library file. For example, maths.lib, mathc.lib and so on.
Run-Time Object Files:
The sub directory called INCLUDE contains header files. These files are also called “include” files. These are text files like the one you generate with the word processor or Turbo C editor. Header files can be combined with your program before it is compiled.
Header files serve several purposes. You can place statements in your program listing that are not program code but are instead messages to the compiler. These messages are called Compiler Directives, can tell the compiler such things as the definitions of words or phrases used in your program. Some useful compiler directives have been grouped together in header files, which can be included in the source code of your program before it goes to the compiler.
Header files also contains the prototypes for the library functions. Prototypes provide the way to avoid program errors.later we will discuss in detail the header files and prototypes.
Programmer Generated Files:
You can place your program anywhere on the Hard Disk. When IDE is loaded you can open it from the hard disk by giving path and enjoy your programming.
Why does C uses so many files?
In time, higher-level languages evolved, such as BASIC and COBOL. These languages let people work with something approximating words and sentences, such as Let I = 100. These instructions were translated back into machine language by interpreters and compilers. An interpreter translates a program as it reads it, turning the program instructions, or code, directly into actions. A compiler translates the code into an intermediary form. This step is called compiling, and produces an object file. The compiler then invokes a linker, which turns the object file into an executable program.Because interpreters read the code as it is written and execute the code on the spot, interpreters are easy for the programmer to work with. Compilers, however, introduce the extra steps of compiling and linking the code, which is inconvenient. Compilers produce a program that is very fast each time it is run. However, the time-consuming task of translating the source code into machine language has already been accomplished.
Another advantage of many compiled languages like C++ is that you can distribute the executable program to people who don't have the compiler. With an interpretive language, you must have the language to run the program.
For many years, the principle goal of computer programmers was to write short pieces of code that would execute quickly. The program needed to be small, because memory was expensive, and it needed to be fast, because processing power was also expensive. As computers have become smaller,cheaper, and faster, and as the cost of memory has fallen, these priorities have changed. Today the cost of a programmer's time far outweighs the cost of most of the computers in use by businesses.Well-written, easy-to-maintain code is at a premium. Easy- to-maintain means that as business requirements change, the program can be extended and enhanced without great expense.
This is dedicated to Living memory of