C – Program Structure1 min read

Before we start the basic building blocks of the C programming language, we must know the Program Structure of C for the building of programs.

A C program basically consists of the following parts:

  • Preprocessor Commands.
  • Functions.
  • Variables.
  • Statement & Expressions.
  • Comments.

Let see the basic structure below to print Hello World:

Now, let’s know the various parts of the above example:

  1. #include <stdio.h> is a preprocessor command, the first line of the program that adds the stdio.h file before the program compilations.
  2. Next is int main() which is the main function where the program execution begins.
  3. /*...*/ or // is a comment box that will not be executed by the compiler.
  4. printf(...)is a function in C that displays the message “Hello, World!” on the screen. The message needs to be under " ".
  5. return 0; in a program terminates the main() function and returns the value 0.

MORE

Implement Insertion sort Program in C

In this tutorial, we will learn and write a C program to implement insertion sort. Before that you may go through the following topics in …
Read More

C Program for implementation of Selection sort

In this tutorial, we will learn and write a C program to implement selection sort using function. Before that you may go through the following …
Read More

C Program to Delete a Particular element from an Array

In this tutorial, we will write a C program to delete an element in an array by specifying the value. Before that, you should have …
Read More

C Program to sort a String in Ascending order

In this tutorial, we will write a c program to sort a string array in ascending order. Before that, you may go through the following …
Read More

C Program to find Maximum occurring Character in a String

In this tutorial, we will write a program in C to find the maximum occurring character in a string. Before that, you may go through …
Read More

Keith Number Program in C

In this tutorial, we will write a Keith number in C. It is one of the most asked questions in an interview. Before that, you …
Read More