Skip to content
  • Linkedin
  • Youtube
  • Pinterest
  • Home
  • Privacy Policy
  • About
  • Contact
Programmingoneonone

Programmingoneonone

Programmingoneonone is a website that publishes daily tutorials, methods, guides, and articles on IT, Education, and technology.

  • Home
  • Human Values
  • DSA
  • IoT Tutorials
  • Interview Questions and Answers
  • Toggle search form
basic structure of c program

Basic Structure of C Program

Posted on 29 May 202120 May 2023 By YASH PAL No Comments on Basic Structure of C Program

The basic structure of c program – C Programming is a Structured programming language. it allows writing programs in small modules. and because C follows a structure it is easy to debug, testing and maintenance.

Structure of a C Program

Include Header File Section
Global Declaration Section
main()                          
{                                  
Declaration Part
Execution Part
}                                 
User-defined Functions
{                               
Statements
}

Include Header File Section

Every C program has some header files that are used for function definition that is used in the program. in c programming, each header file is by default extended with .h extension. header files are files that have defined some functions in them that we can use in our program. and in the header file section, we include the necessary header files.

Global Declaration

In the global declaration section, we can define some variables that are used by more than one function. and it is a must that all the variables should declare outside of all the functions. and these variables are known as global variables.

Main Function

In c programming, every program must have a main() function. because the main() function is the starting point of every C program. and the execution of the program always begins with the open curly bracket of the main() function.

Declaration Part

The declaration part declares the entire variables that are used in the executable part. means we set some values to the variables that are used in the program.

Executable Part

The execution part contains the statements that need to execute. it contains a set of statements or a single statement. and all these statements are enclosed between the braces of the main function.

User-Defined Function

In the user-defined section, the user defines some functions for doing some tasks. and generally, this section would be defined after the main() function.

Steps For Executing The Program

Generally in C programming, the execution of a program is done in three steps.

  1. Creation of program
  2. Compilation of a program
  3. Execution of the program

Creation of program

To create a c program we can use a C editor or any online editor. after creating a program we can save it with the .c extension. By default file extension is .c but it is not necessary to save the file with the .c extension.

Compilation of a program

To convert a c program from human language to machine language we need a compiler. and the conversion of code from human language to machine language is called compilation. and this part is done after all the statements get correct. if there is no error in the program then the machine code of the program is stored in another file with the same name and .obj extension.

Execution of the program

After the successful creation of the .obj file and generation of machine code. the whole machine code is loaded into the computer’s main memory and the program is executed.

Read other Tutorials

  • History of c programming language
  • C character sets
C Programming Tutorials, Programming Tutorials Tags:c, computer science

Post navigation

Previous Post: Introduction to C Programming Language
Next Post: Computer Science Interview Questions and Answers

Related Tutorials

Reading input in c programming Reading Input in a C program C Programming Tutorials
The First C Program C Programming Tutorials
Compiling C Programs C Programming Tutorials
History of c programming language HISTORY OF C Programming Language C Programming Tutorials
c character sets C Character Sets C Programming Tutorials
c programming interview questions and answers C Programming Interview Questions and Answers C Programming Tutorials

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Pick your Subject

  • Internet of Things
  • Data Structures/Algorithms
  • Interview Preparation
  • Human Values
  • Java Interview Questions and Answers (2023)
    Thinking of becoming a Java developer? I must say it’s a good choice! Java is continuously named the most popular programming language. And the...

    Learn More “Java Interview Questions and Answers (2023)” »

  • Iot(Internet of things) in healthcare
    IoT in Healthcare
    IoMT (Internet of Medical Things) stands for devices that can collect and exchange data – either with users or other devices via the internet,...

    Learn More “IoT in Healthcare” »

  • four stages of iot solution for industry
    IoT for Industry
    In this post, we are going to learn about use cases of IoT for Industry and four stages for providing IoT solutions. Machine Diagnosis...

    Learn More “IoT for Industry” »

  • Iot for agricultural
    IoT in Agriculture
    IoT technology has realized smart wearables, connected devices, automated machines, and driverless cars. However, in agriculture, the IoT has brought the greatest impact. Amongst the challenges...

    Learn More “IoT in Agriculture” »

  • Iot for logistics
    IoT in Logistics and Supply Chain
    IoT applications for smart logistics and supply chain systems:  Logistics Fleet Tracking  To track the locations of the vehicles in real time, the vehicle...

    Learn More “IoT in Logistics and Supply Chain” »

  • Algorithms Tutorials
  • Basic Programming
  • C Programming Tutorials
  • C++ Tutorials
  • Compiler Design Tutorials
  • Computer Networks Tutorials
  • Computer Organization Tutorials
  • Computer Science Tutorials
  • Data Structures Tutorials
  • DBMS Tutorials
  • Developer Guide
  • Digital Communication
  • Digital Logic Tutorials
  • Internet of Things Tutorials
  • Internet Tutorials
  • Interview questions answers
  • Java Tutorials
  • Javascript Tutorials
  • Machine Learning Tutorials
  • Operating Systems Tutorials
  • Programming Tutorials
  • Projects
  • Tips&Tricks
  • Tools
  • VBScript Tutorials
  • Java Interview Questions and Answers (2023)
    Thinking of becoming a Java developer? I must say it’s a good choice! Java is continuously named the most popular programming language. And the...

    Learn More “Java Interview Questions and Answers (2023)” »

  • Iot(Internet of things) in healthcare
    IoT in Healthcare
    IoMT (Internet of Medical Things) stands for devices that can collect and exchange data – either with users or other devices via the internet,...

    Learn More “IoT in Healthcare” »

  • four stages of iot solution for industry
    IoT for Industry
    In this post, we are going to learn about use cases of IoT for Industry and four stages for providing IoT solutions. Machine Diagnosis...

    Learn More “IoT for Industry” »

  • Iot for agricultural
    IoT in Agriculture
    IoT technology has realized smart wearables, connected devices, automated machines, and driverless cars. However, in agriculture, the IoT has brought the greatest impact. Amongst the challenges...

    Learn More “IoT in Agriculture” »

  • Iot for logistics
    IoT in Logistics and Supply Chain
    IoT applications for smart logistics and supply chain systems:  Logistics Fleet Tracking  To track the locations of the vehicles in real time, the vehicle...

    Learn More “IoT in Logistics and Supply Chain” »

Copyright © 2023 Programmingoneonone.

Powered by PressBook Blog WordPress theme