Pop operation in Stack

POP Operation In this  operation topmost element is deleted from the stack.Before deleting check if TOP = NULL.If yes,it means that stack is empty and no deletion can be done.If an attempt to delete element is made in this case the UNDERFLOW message will be printed on screen.If no,then element is deleted then value of… read more »

Push operation in Stack

Push Operation In this operation,the element is inserted at the top of stack(Fig 4). In order to insert element we need to check whether TOP = MAX-1. If  yes,then insertion  is not possible. If  element is still  tried for insertion , OVERFLOW message will be printed on screen as the stack do not have extra… read more »

Binary Search

Binary Search The binary search technique works only on sorted array.It works by comparing the input element to the middle element of array.The comparison determines whether the element is less than.greater than or equal to middle element.Subsequent steps to be followed are written and explained by the following program. Program #include <stdio.h> int main() {… read more »

Strings in C

String is a collection of characters that forms a word.It is stored in one dimensional array and terminated by null(\0) character.The size of array is one more than the length of string as it required to store null character.The compiler itself places a null character at the end of array during its initialization Syntax char… read more »

Loop Control Statements

Loop Control Statements alter  execution of a program from the normal execution sequence.The statements are as follows break continue goto break statement break statement terminates the execution of loop immediately ineffective of the condition status.The control is transferred to the first statement after the loop block.If break statement is used in nested loops      (Refer : Nesting of Loops) then innermost loop is… read more »

Nesting of loops

Loops can be nested if required.Nesting means to have one or more loops inside the main loop. Syntax of nested for loops for(initialization;condition;iteration) { for(……) { for(…) {… } ……. } } Syntax of nested while loops while(condition) { ….. while(condition) { …….. } …. } Syntax of nested do-while loop do { statements; …… read more »

while loop

While loop keeps on executing the given statements as long as the condition is true.When the condition  turns out to be false then set of statements in the block never gets executed and the control goes to first line after the while block. Syntax while(condition) { set_of_statements; iteration statement; } If the condition is true,then set… read more »

for loop

Loops are control structures that are used to execute a code several times.There may be situation when we need to print series from 1-100 or we need to print our name 1000 times on screen.It will be inappropriate to use 100 or thousand  times printf for this scenario.Loops can be used to efficiently perform the task as… read more »

Decision Making Statements

Decision Making Statements are the statements that imposes one or more conditions on the expression and if the conditions evaluates to be true then specific actions are followed,if not true then some other actions are followed.They are called as decision making as it leads to a particular conclusion/decision.In C,true values are treated as non-zero i.e.1… read more »


A function is a group of statements that performs some specific task.They can be used in other programs depending on their accessibility and are ended by brackets.In order to define a function inside  a program we need to specify three things: Function Declaration Function Definition Function Calling Some functions are pre-defined like main(),printf(),scanf().We just need… read more »