C – while loop in C programming

A loop is used for executing a block of statements repeatedly until a given condition returns false. In the previous tutorial we learned for loop. In this post we will learn while loop in C. while loop Syntax of while loop: while (condition test) { //Statements to be executed repeatedly // Increment (++) or Decrement … Read more

C – for loop in C programming

A loop is used for executing a block of statements repeatedly until a given condition returns false. C For loop This is one of the most frequently used loop in C programming. Syntax of for loop: for (initialization; condition test; increment or decrement) { //Statements to be executed repeatedly } Flow Diagram of For loop … Read more

Shell Script Example – Linux

linux

Shell Script Example – Linux for ((j=12;j<=31;j++)); do echo $j year=2020 month=01 day=$j mkdir /mnt/recording/final/11/$year-$month-$day results=($(mysql –user name -ppassword -h 192.168.2.4 db -Bse “SELECT id FROM calldetails  WHERE calldate BETWEEN ‘$year-$month-$day 00:00:00’ AND ‘$year-$month-$day 23:00:00′”)) cnt=${#results[@]} for (( i=0 ; i<cnt ; i++ )) do a=${results[$i]} echo auid=$a; cp /home/data/$year-$month-$day/$a.gsm /mnt/recording/final/11/$year-$month-$day/$a.gsm done done  

Shell Script : Nested for loop statement

linux

Shell Script : Nested for loop statement Nested for loops means loop within loop. They are useful for when you want to repeat something serveral times for several things. For example, create a shell script called nestedforloop.sh: #!/bin/bash # A shell script to print each number five times. for (( i = 1; i <= … Read more

C – If..else, Nested If..else and else..if Statement

C If else statement Syntax of if else statement: If condition returns true then the statements inside the body of “if” are executed and the statements inside body of “else” are skipped. If condition returns false then the statements inside the body of “if” are skipped and the statements in “else” are executed. if(condition) { … Read more

If statement in C programming

When we need to execute a block of statements only when a given condition is true then we use if statement. In the next tutorial, we will learn C if..else, nested if..else and else..if. C – If statement Syntax of if statement: The statements inside the body of “if” only execute if the given condition … Read more

Operator precedence and Associativity in C programming language

Operator Precedence in C Operator precedence determines which operator is evaluated first when an expression has more than one operators. For example 100-2*30 would yield 40, because it is evaluated as 100 – (2*30) and not (100-2)*30. The reason is that multiplication * has higher precedence than subtraction(-). Associativity in C Associativity is used when … Read more