One of the main problems of a person who wants to start learning the programming languages C / C ++, while knowing almost nothing about them, may be the lack of an initial foothold. This article is designed to help beginners take the first steps on an exciting journey to learn this family of languages.
So, before rushing into the depths of the Internet in search of programming lessons in C, you need to prepare yourself a good ground - a programming environment. At the moment there is a considerable number of programs that allow writing programs in the language in question, performing syntax checking and compiling (translating) the source code of the program into an executable file (with the extension * .exe). Among them, I would like to mention first of all Borland C, Borland C ++, Dev-C ++, Visual Studio, Eclipse, NetBeans, IDEA. I especially want to look at the rather old but still popular Borland C ++ environment (using the example of version 5.5.1) due to the presence of some difficulties in setting it up (however, it’s better to use a more modern and more automated environment).
So, first of all you need to download the Borland C ++ compiler itself, included in the Borland Free Command Line Tools installer package (freecommandLinetools.exe file). Running the downloaded file, install the proposed compiler, selecting all the default options. Installation will occur in the folder C: \ Borland \ BCC55. Going into it, among other folders, you can see the Bin folder, inside which there are several executable files. Launching them directly, we see that the DOS window is blinking (usually black) and disappears immediately. You ask how to manage to do something and, in general, to consider what is written. The answer is using the built-in Windows command line. You can call it as follows. Hold down the key combination Win + R on the keyboard and enter in the appeared window three letters - cmd. In order to run the programs that are in the mentioned Bin folder, you must first go to this folder on the command line. This is done by entering the cd C: \ Borland \ BCC55 command. To start the program now you only need to enter the name of the program Immediately I will say that we need the file bcc32.exe, which is the main program that compiles the source code in C, into an executable exe file.
In order not to write the cd C: \ Borland \ BCC55 command every time, you need to add this path to the so-called. Windows PATH variable. Having done this, the system (including the command line) will be aware of the presence of this path, and then you can restrict yourself to the command line only with the bcc32.exe command without specifying the path to this file. So, this is done as follows. Having found the icon or the “My Computer” menu on the desktop or in the “START” menu, right-click on it and go to “Properties”. Next, enter additional parameters (Fig. 1) and click on the "Environment Variables ..." button.
')

Fig.1.
In the "System Variables" window, find the Path variable and add it via ";" at the end of its contents, the path is C: \ Borland \ BCC55 \ Bin \ (Fig.2).

Fig.2.
Next, you need to create two configuration files in the Bin folder (ie, with the extension * .cfg) - bcc32.cfg and ilink32.cfg.
bcc32.cfg should contain 2 lines:
-I "C: \ Borland \ BCC55 \ Include"
-L "C: \ Borland \ BCC55 \ Lib"
ilink32.cfg should contain 1 line:
-L "C: \ Borland \ BCC55 \ Lib"
Basically, this is where the Borland C ++ installation is complete.
Now let's write traditionally the first program “Hello, World!”. Before you start writing a program, you need to know that a C program must be written in a text file with the extension * .c, and a program containing the same C ++ commands must be written in a text file with the extension * .cpp. So, create a text file named first.txt and replace the extension .txt with .c. We open this file with a notepad (in my opinion, the best Notepad ++ is the upgraded notepad, because it supports the syntax of the C / C ++ language, highlighting it and highlighting the program blocks, which makes the visual perception of the code much easier) and write the following lines:
#include <stdio.h>
int main()
{
printf("Hello, World!");
}
Save this file. Go to the command line and write the command bcc32.exe first.c. As a result, the compiler will check the code for errors and create the first.exe executable file, a program that displays the message “Hello, World!” On the screen (in the same command line window).
The line #include <stdio.h> tells the compiler to include the stdio.h file (stdio stands for STanDard Input-Output), containing information about most of the basic functions of the C language. This file and similar files are in the Include folder. Further, any C program starts its execution from the main function main (), the result of which should be an integer of type int (integer). In curly brackets, the body of the function is written - a sequence of commands and operators that are executed in turn. The printf (Print Formatted) function is designed to output formatted text to a standard I / O device. After each such function, a semicolon is required.
Now that you are ready to write programs in C (when you already know the whole sequence of actions before generating the exe file), you can start using some tutorial, a textbook or online lessons. I would like to mention the remarkable book by Kernighan and Ritchie (actually, they are the creators of C) “Programming in C” (2nd edition, 2009), in which many subtleties of the language are presented in an accessible language and with which you can begin to feel the language itself. Good luck and success in your journey!
PS For (more) operational efficiency when writing a program in C / C ++, I strongly recommend using Total Commander's file manager (or you can use FAR). With this program, you can quickly create new text files with the extension * .c (or * .cpp), with one keystroke call the command line (rather than crawl every time in the Start menu) and as a result quickly complete the process of compiling the source code.