Monthly Archives: November 2020

10. C – Type Casting

Converting one datatype into another is known as type casting or, type-conversion. There are two types of type conversion: Implicit Type Conversion Also known as ‘automatic type conversion’. Done by the compiler on its own, without any external trigger from the user. Generally takes place when in an expression more than one data type is… Read More »

11. C – Input and Output

When we say Input, it means to feed some data into a program. An input can be given in the form of a file or from the command line. C programming provides a set of built-in functions to read the given input and feed it to the program as per requirement. When we say Output, it means… Read More »

12. C – Conditional Statements

What is a Conditional Statement in C? Conditional Statements in C programming are used to make decisions based on the conditions. Conditional statements execute sequentially when there is no condition around the statements. If you put some condition for a block of statements, the execution flow may change based on the result evaluated by the condition.… Read More »

13. C – switch Statement

The switch statement allows us to execute one code block among many alternatives. You can do the same thing with the if…else..if ladder. However, the syntax of the switch statement is much easier to read and write. Syntax of switch…case How does the switch statement work? The expression is evaluated once and compared with the values of each case label. If there is… Read More »

14. C – Loops

A loop statement allows us to execute a statement or group of statements multiple times. Given below is the general form of a loop statement in most of the programming languages In programming, a loop is used to repeat a block of code until the specified condition is met. C programming has three types of… Read More »

15. C – Nested Loops

C supports nesting of loops in C. Nesting of loops is the feature in C that allows the looping of statements inside another loop. Syntax of Nested loop Outer_loop   {       Inner_loop      {            // inner loop statements.      }          // outer loop statements.   }   Outer_loop and Inner_loop are the valid loops that can be a ‘for’ loop, ‘while’ loop or ‘do-while’ loop. Nested for loop The nested for… Read More »

16. C – goto Statement

The goto statement allows us to transfer control of the program to the specified label. Syntax of goto Statement The label is an identifier. When the goto statement is encountered, the control of the program jumps to label: and starts executing the code. Example: goto Statement Output 1. Enter a number: 3 2. Enter a number: 4.3 3. Enter a number: 9.3 4. Enter… Read More »

17. C – break Statement

The break statement ends the loop immediately when it is encountered. Its syntax is: The break statement is almost always used with if…else statement inside the loop. How does the break statement work? Example: break statement Output Enter a n1: 2.4 Enter a n2: 4.5 Enter a n3: 3.4 Enter a n4: -3 Sum = 10.30 This… Read More »

18. C – continue Statement

The continue statement skips the current iteration of the loop and continues with the next iteration. Its syntax is: The continue statement is almost always used with the if…else statement. How continue statement works? Example: continue statement Output Enter a n1: 1.1 Enter a n2: 2.2 Enter a n3: 5.5 Enter a n4: 4.4 Enter a n5: -3.4 Enter a n6:… Read More »

19. C – Single Dimension Array

Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such… Read More »