In this article we will learn the step-by-step process for creating and running C programs. Before jumping into the steps, read introduction to C programming language. This article is a part of C programming tutorial for beginners.
Watch this video to learn about creating and running C programs in Windows:
Watch this video to learn about creating and running C programs in Linux:
The steps in creating and running programs are: writing/editing, compiling, linking and execution. These steps can be viewed diagrammatically as shown below:
Writing/Editing
The first step in creating programs is, writing or editing the program. A program can be written in any text editor like notepad. After writing a program, the program must be saved, In C language, the program is saved with the extension “.c”. This is the source program written in a high-level language.
Compilation
After writing and saving the source program, the next step is compilation. Here we will use a software called as compiler, which converts a program written in high-level language into machine language. The resultant file is known as an object file in C. The extension of that file is “.obj”.
Linking
After compilation the next step is linking. Here software called linker is used. The linker links the program with external library files which contains the code for predefined functions and creates an executable file. The extension of the executable file is “.exe”.
Execution
Finally after the executable file is created after linking, the next step is execution. The operating system executes the executable file which is the machine code with the help of the CPU and other hardware components.
Watch this video to learn detailed steps in creating and executing a C program:
Watch this video for a demo on detailed steps in creating and executing a C program:
Next, let’s learn structure of a C program.
Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.
Leave a Reply