We know that to code a java program or an HTML code in notepad++ is fun during our initial level of learning, So if the same happens with your c/c++ program that you can run their program in notepad++ is might be interesting for you.
As we all know the turbo c compiler is not running perfectly in win 8 or win 10 pc. So for all these problems, there is one-stop solution and that is GCC compiler
So, have a look over what is GCC and how it works
GCC stands for GNU Compiler Collection. It is a compiler software supporting various Programming languages. It includes compilers for C, C++, Objective-C and a host of other languages.
How it works
Let’s understand this scenario with this example, so we go through the compilation of simple c program, First of all, we have to write a simple hello world program in notepad++
Now we have a file named hello.c . The goal is to make the system interpret the C code and convert it into a machine language that the system understands. There are numerous of processes through which the code undergoes to achieve the final output. we will look over each and every step.
The C preprocessor, also known as CPP, is a macro processor that is used automatically by the C compiler to transform the program before compilation. The C Preprocessor is not a part of the compiler but is a separate step in the compilation process all preprocessor commands begin with a hash symbol (#), for example,
#define – This macro defines constant value and can be any of the basic data types.
#include <file_name> – it is included in the main C program where “#include <file_name>” is mentioned.
“#ifdef” directive- checks whether the particular macro is defined or not. If it is defined, “If” clause statements are included in the source file. Otherwise, “else” clause statements are included in the source file for compilation and execution.
#undef– directive undefines existing macro in the program.
So, when we write gcc hello.c in command it automatically pre-processes the program. After hitting the enter a file name with a.exe is created in the same directory.
The compilation is the process in which the computer takes to convert a high-level programming language into a machine language that the computer can understand. So, our next step is to take the Preprocessed file as input and compile it to produce an intermediate compiled and desired output. The output file for this stage produces Assembly code which is machine-dependent.
To compile the program we have to write a and then press enter
Here it is, I hope you understand to write a program in notepad++ and how to run it. Feel free to comment.
To download GCC for windows click on below link