Introduction to C Programming

- Don't think like a human, think like a compiler




PREVIEW OF OUR MATERIAL

I CHAPTER : Introduction to programming


II CHAPTER : Arrays, Strings, Structure & Pointer



CHAPTER III : Preprocessor & File handling in C 

CHAPTER IV : Function & Dynamic Memory Allocation

CHAPTER V :Files & Introduction to Algorithm




C Programming Language is a very famous pc programming language thru which customers and computer systems can communicate. Using this sequence of tutorials, one can analyze C Programming Language from the basics. Every subject in these tutorials is defined with clear records and accurate examples. The content material of all the matters is organized by way of very skilled and specialist faculty.

What is C?

C is a laptop programming language used to plan pc software program and applications.

Why do we use C?

We use the C programming language to format laptop software program and applications.

Who invented C?

C Programming Language used to be invented in the yr 1972 with the aid of Dennis Ritchie (Dennis MacAlistair Ritchie). He was once an American Computer Scientist labored at Bell Labs as a researcher alongside with Ken Thompson. He was once born on ninth September 1941 and lived until twelfth October 2011. He is stated to be the Father of C.

Dennis Ritchie - Father of  C Programming

Software used to create and execute a C Program
Following are the functions and software program used to create and execute C programs.

1. Dev c++
2. Turbo C++
3. GNU C
4. Code Blocks
5. Net Beans

Creating and Running C Program

Generally, the packages created the usage of programming languages like C, C++, Java, etc., are written the use of a high-level language like English. But, the laptop can't apprehend the high-level language. It can recognize solely low-level language. So, the software written in the high-level language wishes to be transformed into the low-level language to make it comprehensible for the computer. This conversion is carried out the use of both Interpreter or Compiler.

Popular programming languages like C, C++, Java, etc., use the compiler to convert high-level language directions into low-level language instructions. A compiler is a software that converts high-level language directions into low-level language instructions. Generally, the compiler performs two things, first it verifies the application errors, if blunders are found, it returns a listing of blunders in any other case it converts the whole code into the low-level language.

To create and execute C applications in the Windows Operating System, we want to installation Turbo C software. We use the following steps to create and execute C packages in Windows OS…


Step 1: Creating a Source Code

Source code is a file with C programming guidelines in a high-level language. To create supply code, we use any textual content editor to write the software instructions. The guidelines written in the supply code need to observe the C programming language rules. The following steps are used to create a supply code file in Windows OS…

Click on the Start button
Select Run
Type cmd and press Enter
Type cd c:\TC\bin in the command instant and press Enter
Type TC press Enter
Click on File -> New in C Editor window
Type the program
Save it as FileName.c (Use shortcut key F2 to save)

Step 2: Compile Source Code (Alt + F9)

The compilation is the system of changing high-level language guidelines into low-level language instructions. We use the shortcut key Alt + F9 to bring together a C software in Turbo C.

The compilation is the process of converting high-level language into low-level language instructions.

Whenever we press Alt + F9, the supply file is going to be submitted to the Compiler. On receiving a supply file, the compiler first tests for the Errors. If there are any Errors then compiler returns List of Errors, if there are no blunders then the supply code is transformed into object code and shops it as a file with .obj extension. Then the object code is given to the Linker. The Linker combines each the object code and targeted header file code and generates an Executable file with a .exe extension.

Step 3: Executing / Running Executable File (Ctrl + F9)

After finishing compilation successfully, an executable file is created with a .exe extension. The processor can apprehend this .exe file content material so that it can operate the assignment particular in the supply file.

We use a shortcut key Ctrl + F9 to run a C program. Whenever we press Ctrl + F9, the .exe file is submitted to the CPU. On receiving .exe file, CPU performs the assignment in accordance to the practise written in the file. The end result generated from the execution is positioned in a window referred to as User Screen.


Step 4: Check Result (Alt + F5)

After strolling the program, the end result is positioned into User Screen. Just we want to open the User Screen to take a look at the end result of the software execution. We use the shortcut key Alt + F5 to open the User Screen and test the result.

Execution Process of a C Program
When we execute a C software it undergoes with the following procedure

The file which consists of c application guidelines in a high-level language is stated to be supply code. Every c software supply file is saved with .c extension, for example, Sample.c.

Whenever we press Alt + F9 the supply file is submitted to the compiler. Compiler assessments for the errors, if there are any errors, it returns a listing of errors, in any other case generates object code in a file with identify Sample.obj and put up it to the linker. The linker combines the code from designated header file into an object file and generates executable file as Sample.exe. With this compilation technique completes.

Now, we want to run the executable file (Sample.exe). To run a software we press Ctrl + F9. When we press Ctrl + F9 the executable file is submitted to the CPU. Then CPU performs the project in accordance to the guidelines written in that software and area the end result into UserScreen.

Then we press Alt + F5 to open UserScreen and take a look at the end result of the program.

Important Points

software file (Source file) ought to keep with .c extension.
The compiler converts whole application at a time from high-level language to low-level language.
Input to the compiler is .c file and output from the compiler is .exe file, however it additionally generates .obj file in this process.
The compiler converts the file solely if there are no mistakes in the supply code.
CPU locations the end result in User Screen window.
Overall Process
Type the software in C editor and store with .c extension (Press F2 to save).
Press Alt + F9 to bring together the program.
If there are errors, right the blunders and recompile the program.
If there are no errors, then press Ctrl + F9 to execute/run the program.
Press Alt + F5 to open User Screen and test the result.