Category: 02. C

  • Function Call by Value in C

    In C language, a function can be called from any other function, including itself. There are two ways in which a function can be called − (a) Call by Value and (b) Call by Reference. By default, the Call by Value mechanism is employed. Formal Arguments and Actual Arguments You must know the terminologies to…

  • Main Function

    In a C program, the main() function is the entry point. The program execution starts with the main() function. It is designed to perform the main processing of the program and clean up any resources that were allocated by the program. In a C code, there may be any number of functions, but it must have a main() function. Irrespective of its place…

  • Functions in C

    A function in C is a block of organized reusuable code that is performs a single related action. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. When the algorithm of a certain problem involves long and complex logic, it is broken into smaller,…

  • Goto Statement in C

    What is goto Statement in C? The goto statement is used to transfer the program’s control to a defined label within the same function. It is an unconditional jump statement that can transfer control forward or backward. The goto keyword is followed by a label. When executed, the program control is redirected to the statement following the label.If the label points to…

  • Continue Statement in C

    The behaviour of continue statement in C is somewhat opposite to the break statement. Instead of forcing the termination of a loop, it forces the next iteration of the loop to take place, skipping the rest of the statements in the current iteration. What is Continue Statement in C? The continue statement is used to skip the execution of the rest…

  • Break Statement in C

    The break statement in C is used in two different contexts. In switch-case, break is placed as the last statement of each case block. The break statement may also be employed in the body of any of the loop constructs (while, do–while as well as for loops). When used inside a loop, break causes the loop to be terminated. In the switch-case statement, break takes the control out of the switch scope after…

  • Infinite Loop

    In C language, an infinite loop (or, an endless loop) is a never-ending looping construct that executes a set of statements forever without terminating the loop. It has a true condition that enables a program to run continuously. Flowchart of an Infinite Loop If the flow of the program is unconditionally directed to any previous step, an infinite loop…

  • Nested Loops in C

    In the programming context, the term “nesting” refers to enclosing a particular programming element inside another similar element. For example, nested loops, nested structures, nested conditional statements, etc. Nested Loops When a looping construct in C is employed inside the body of another loop, we call it a nested loop (or, loops within a loop). Where, the loop that…

  • Do-While Loop in C

    The do-while loop is one of the most frequently used types of loops in C. The do and while keywords are used together to form a loop. The do-while is an exit-verified loop where the test condition is checked after executing the loop’s body. Whereas the while loop is an entry-verified. The for loop, on the other hand, is an automatic loop. Syntax of do while Loop The syntax of do-while…

  • For Loop in C

    Most programming languages including C support the for keyword for constructing a loop. In C, the other loop-related keywords are while and do-while. Unlike the other two types, the for loop is called an automatic loop, and is usually the first choice of the programmers. The for loop is an entry-controlled loop that executes the statements till the given condition. All the elements (initialization, test…