In C programming, there aren’t “commands” in the way that there might be in scripting languages or command line interfaces. Instead, there are functions, statements, and expressions which can be used to perform various tasks.

Here’s a brief overview:

  1. Function Calls:
    Functions are blocks of code that are designed to do one particular job. When you want to use a function, you “call” it in your program. For example, the printf function is used to print text to the screen:
   printf("Hello, World!\n");
  1. Variable Declarations:
    In C, you must declare variables before you use them, specifying the variable’s name and type:
   int number;
   char letter;
  1. Assignment Statements:
    You can assign values to variables with the assignment operator =:
   number = 10;
   letter = 'a';
  1. Control Statements:
    Control statements like if, for, while, and switch allow you to control the flow of program execution:
   if (number > 5) {
       printf("Number is greater than 5\n");
   }

   for (int i = 0; i < 10; i++) {
       printf("%d\n", i);
   }

   while (number > 0) {
       printf("%d\n", number);
       number--;
   }
  1. Expression Statements:
    Expressions can be used as statements too. For example:
   number++;
  1. Return Statements:
    In C, the return statement is used to end the execution of a function and possibly return a value to the calling function:
   return 0;
  1. Library Functions:
    C has a standard library of functions that provide useful operations such as input/output, memory management, and mathematical computations. For example:
   double square_root = sqrt(25.0);  // Computes the square root of 25

These are some of the basic “commands” or rather statements, expressions, and function calls you might use in a C program. Each allows you to perform different operations and control the behavior of your program in various ways.


Below are examples for each category provided:

  1. Function Calls:
   #include <stdio.h>

   int main() {
       printf("Hello, World!\n");
       return 0;
   }
  1. Variable Declarations:
   #include <stdio.h>

   int main() {
       int number;
       char letter;
       return 0;
   }
  1. Assignment Statements:
   #include <stdio.h>

   int main() {
       int number = 10;
       char letter = 'a';
       printf("Number: %d, Letter: %c\n", number, letter);
       return 0;
   }
  1. Control Statements:
   #include <stdio.h>

   int main() {
       int number = 10;

       if (number > 5) {
           printf("Number is greater than 5\n");
       }

       for (int i = 0; i < 10; i++) {
           printf("%d\n", i);
       }

       while (number > 0) {
           printf("%d\n", number);
           number--;
       }

       return 0;
   }
  1. Expression Statements:
   #include <stdio.h>

   int main() {
       int number = 10;
       number++;
       printf("Number: %d\n", number);  // Output: Number: 11
       return 0;
   }
  1. Return Statements:
   #include <stdio.h>

   int main() {
       return 0;
   }
  1. Library Functions:
   #include <stdio.h>
   #include <math.h>

   int main() {
       double square_root = sqrt(25.0);
       printf("Square root: %f\n", square_root);  // Output: Square root: 5.000000
       return 0;
   }

Each of these examples demonstrates how the aforementioned statements, expressions, and function calls are used within a C program.


The line #include <stdio.h> is a preprocessor directive in C that includes the contents of the stdio.h header file in the program. The stdio.h (standard input/output header) file contains declarations of functions and macros used for input and output operations in C programs.

Here’s a breakdown of the parts of this directive:

  1. #include: This is the preprocessor directive that tells the compiler to include a file.
  2. <stdio.h>: This specifies the file to include. The angular brackets (< >) tell the compiler to look for the file in the system’s standard library path.

Here’s an example of how #include <stdio.h> might be used in a simple C program to print “Hello, World!” to the console:

#include <stdio.h>  // Include the standard input/output header file

int main() {
    printf("Hello, World!\n");  // Call the printf function defined in stdio.h to print text
    return 0;  // Indicate successful program termination to the operating system
}

In this program:

  • #include <stdio.h> tells the compiler to include the stdio.h file, which contains the declaration of the printf function among other things.
  • int main() defines the entry point of the program.
  • printf("Hello, World!\n"); calls the printf function to print “Hello, World!” followed by a newline character to the console.
  • return 0; returns control to the operating system, indicating successful program termination.

The #include <stdio.h> directive is essential for using the printf function and other input/output functions provided by C’s standard library.


The directive #include <math.h> is used in C to include the header file math.h, which provides declarations for a variety of mathematical functions and constants. This allows you to perform mathematical operations such as square roots, trigonometric calculations, exponentiation, and logarithmic calculations among others.

Here’s a breakdown of this directive:

  1. #include: This is the preprocessor directive that tells the compiler to include a file.
  2. <math.h>: This specifies the file to include. The angle brackets (< >) tell the compiler to look for the file in the system’s standard library path.

Here’s a simple example of how #include <math.h> might be used in a C program to calculate and print the square root of a number:

#include <stdio.h>  // Include the standard input/output header file
#include <math.h>   // Include the mathematical functions header file

int main() {
    double number = 25.0;
    double result = sqrt(number);  // Call the sqrt function defined in math.h to calculate square root
    printf("The square root of %.2f is %.2f\n", number, result);  // Output: The square root of 25.00 is 5.00
    return 0;  // Indicate successful program termination to the operating system
}

In this program:

  • #include <stdio.h> tells the compiler to include the stdio.h file, which contains the declaration of the printf function.
  • #include <math.h> tells the compiler to include the math.h file, which contains the declaration of the sqrt function among other mathematical functions.
  • double number = 25.0; and double result = sqrt(number); are statements that declare variables and call the sqrt function to calculate the square root of number.
  • printf("The square root of %.2f is %.2f\n", number, result); calls the printf function to print the result to the console.
  • return 0; returns control to the operating system, indicating successful program termination.

Including the math.h header file is essential for using the mathematical functions provided by the C standard library.