ARRAY in C Language: (1) An Array is a collection of variables of the same type that are referenced by a common name. It is used for storing multiple values in one variable. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>//Assign 1-10 values in one variable x container having array of …
DO WHILE Loop in C Language: (1) Unlike the for and while loops, the do-while is an exit-controlled loop i.e. it evaluates its test-expression at the bottom of the loop after executing its loop-body statements. This means that a do-while loop always executes at least once. In other two loops for and while, the test-expression is …
WHILE Loop in C Language: (1) The while statement executes a block of code repeatedly as long as the control condition of the loop is true. The control condition of the while loop is executed before any statement inside the loop is executed. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>//Table …
FOR Loop in C Language: (1) The FOR statement is used to iterate over a range of values or a sequence. The FOR loop is executed for each of the items in the range. (2) Sample C language code and its output, as shown. #include <stdio.h>#include <conio.h>//Table of 2 using for loopint main(){ int x; int …
SWITCH Statement in C Language: (1) SWITCH Statement successively tests the value of an expression against a list of integer or character constants. When a match is found, the statements associated with that constant are executed. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>int main(){ int x; x = 2;switch(x) { …
If Else condition in C Language: (1) If Else statement allows us to write two alternative paths and the control condition determines which path gets executed. In an if-else statement, only the code associated with if (i.e. statement-1) or the code associated with else (i.e. statement-2) executes, never both. (2) Sample C language code and its …
Logical Operators in C Language: (1) Logical Operators are used for assigning values to variables. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>// Logical Operators in C Languageintmain(){int x;int y;x = 5; y = 7; // Returns 1printf(“Return Value: %d\n”, x > 3 && x < 10); // Returns 0printf(“Return Value: …
Comparison Operators in C Language: (1) Comparison Operators are used for comparing two variables. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>// Assignment Operators in C Languageint main(){int x;int y; x = 5; y = 5;printf(“x equals to y: %d\n”, x == y); x = 5; y = 6;printf(“x not equals …