for loops, while loops and if statements then come variables then you have functions and arrays so these like a kind of the basics of the particular language
    All topics of C programming are covered here from basic to expert. Go through all the topics and their concerned programs which are written below them.
    You will need a compiler to execute programs I will recommend you “Turbo c++” or you can also download “dev C++” it is all your choice.

    A compiler converts high-level language into machine language and vice-versa.
    After typing your program, first, you have to save it using “F2” and compile it using “Alt + F9”.
    It will report the errors of the programs. After debugging (means rectifying all errors), the program will be compiled and shows no error. Now, you have to execute it using “Ctrl +F9”.

    C Programming for beginners

    Program to print “hello world” in c language.
    Why we declare the main function in c programming?

    The main function is the most important thing for the execution of c programming. Execution of the program always starts with the main function and ends with the last statement of the main function.
    Variables: It refers to a storage area whose content may vary during the execution of the program.
    Identifiers: It is a sequence of letters and digits.

    1. You should use only alphabets, digits, and underscore(“_”) while naming identifiers.
    2. The first character of the identifier must be “_” or any alphabets.
    3. You cannot use any keyword as an identifier.
    4. Valid identifiers: num, fact, _account, _number,trmp,ip,op etc.
    Datatypes: These are the means to identify the type of data and associated operation of handling it.
    Five fundamentals data types

    1. int
    2. float
    3. double
    4. char
    5. boolean
    String: It is a sequence of characters surrounded by double-quotes. Example: “Time-Table” – It contains 11 characters including the null character.
    Each string literal is by default added with a special character [‘’] which makes an end of the string. ‘’ – Null character -Size 1 byte

    C Programming if-else

    if-else statement is the most important statement to make programs like c program to find the greatest number among the three numbers, C program to determine whether the student is pass or fail. You can make these programs using an if-else statement easily.
    Format of if-else statement





    statement 1;






    statement 2;



    Nested if statements are used in this program.


    Nested if is an if that has another if in its if’s body or in its else body.


    The nested if can have any of the following forms.


    1.     if(condition 1)


             if(condition 2)

                statement 1;

             else statement 2;



            body of else;


    C programs using if-else

    C programs using switch case

    Program to perform arithmetic operations (i.e., addition, subtraction, multiplication, and division) between two numbers in c language using switch case.


    C Programming for-loop


    For loop is the most popular looping statement. We make different types of patterns in c language using for loop like diamond pattern, star pattern, X pattern, W pattern, etc.


    When we use for loop, we should specify three things about a loop for instance.


    • Initialize an integer value to a loop counter.
    • Testing statement to determine whether its value has reached the number of repetitions desired.
    • Increasing or decreasing the value of a loop counter.

    Body of the loop statements is executed repeatedly until the test expression is true. 


    Elements of loop


    1. We must initialize the loop variable, before writing loop statements.
    2. Test expression will decide whether the loop body will execute or not. If the test expression is true, the loop will execute.
    3. Update expression changes the value of a loop variable. Loop update statements execute at the end after executing the body of the loop.

    How to use for loop?

     for(initialize ;testing condition; increment or decrement)






    C Programs using for-loop examples


    Here are the most important c programs using for-loop. Moreover, it also helps you to understand how to use for loop and where you can use for-loop.


    C programming for factorial

    C Program to print table of a number using for loop
    Matrix program in c using array   

    C Programming using while loop


    While loop is known as an entry-controlled loop. It first checks the testing condition, if the condition is true then it will execute the loop otherwise it will not execute the loop.

    int t=2;



    printf(“n hello”);







    C Programming using do-while loop


    A do-while loop is known as an exit-controlled loop. It first executes the loop the first time without checking the test expression and then at the bottom it checks the testing condition. If the testing condition is true then it executes the loop again otherwise it doesn’t execute the loop again. 


    Functions in C Programming


    Define functions?


    A function is a named unit in a program, may or may not accept values, perform some specific action, and may or may not returns the value. It can be called anywhere in the program. 


       It is a subprogram that acts on data and often returns a value.


    There are two types of functions


    Inbuilt functions User-defined functions
    These are part of the compiler package and part of the standard library These are created by the user as per the requirement of the programmer
    For example: – sqrt(), exit() For example: void add()

    What do you mean by recursion?


    Recursion is the process of defining something in terms of itself


    Define the recursive function?


    Recursive function are those functions which call the same function within the body


    These functions have integer return values and arguments.


    Define arguments?


    The argument is the values that are passed to the function and upon which it performs some action.


    Arrays in c programming


    Array: It is a sequence of numbers or letters.


    Matrix– A matrix is an ordered array of numbers. We can perform arithmetic operations like addition, subtraction, and multiplication of matrices only in a square matrix. Square matrices are those which has the same number of rows and columns. Following are the examples of a square matrix: –


    Multi-dimensional arrays


    Matrix A


    A[1][1]         A[1][2]         A[1][3]
    A[2][1]         A[2][2]          A[2][3]
    A[3][1]         A[3][2]          A[3][3]

    Matrix B


    B[1][1]         B[1][2]         B[1][3]
    B[2][1]         B[2][2]          B[2][3]
    B[3][1]         B[3][2]          B[3][3]

    Matrix C
    C[1][1]         C[1][2]         C[1][3]

    C[2][1]         C[2][2]          C[2][3]
    C[3][1]         C[3][2]          C[3][3]

    To make the Matrix program in c using an array, we use nested for loop.



    Pointers are those variables that are used to store the address of another variable.




    void main()



    int *pt,num;




    printf(“n Value of num is %d”,num);

    printf(“n Address of num is %u”,&num);

    printf(“n num is %d”,*pt);

    printf(“n num is stored at address %u”,pt);

    printf(“n Address of pt is %u”,&pt);






    Value of num is 5


    Address of num is 65522


    num is 5


    num is stored at address 65522


    Address of pt is 65524


    Here pt is a pointer similarly it contains the memory address of another int variable called num. We initialize the num variable with the value of 5. Moreover, we store the address of the “num” variable in “pt”. Now, we can print the number stored in the num variable by two methods.


    1. Printing the value stored in num variable
    2. Printing *pt, which contains the address of num variable but when we print *pt. Therefore, it will print the number stored at that address.

    Header files used in c programming:


    A header file is a file with an extension.h (except in dev c++ where you can write without extension .h) which contain c functions declarations.


    For example: stdio.h, conio.h, iostream.h


    Why we include header files?


    when we use functions like printf, scanf, exit, sqrt, etc. then we need a header file to get the definition of library functions or input-output functions.


    <stdio.h> is used for the following


    printf= Used to print the character.

    scanf= Used to read a character, string, number from the keyboard.


    <conio.h> is used for the following


    clrscr() = Used to clear the screen.


    getch()= Used to input a character.

    getch() is an unformatted console input function without giving echo on-screen.