The while loop in c is an entry controlled loop (Entry Controlled Loops are used when checking of a test condition is mandatory before executing the loop body). It is generally used where we don’t know the number of iterations. Syntax of while loop in C: Example: output: Here, we are calculating the sum of […]
February 27, 2022 | C | No comments
Let us take a look at the various ways to use loops in c. Infinite loop An infinite loop in c does not end, in other words, its condition never becomes true and keeps on updating forever. It is also known as an endless loop or indefinite loop. Example: Output: Here for(;;) is an infinite […]
February 27, 2022 | C | No comments
The programs that we have created so far were of limited nature, because on execution, they always perform the same series of actions, in the same way exactly once. Therefore, for times when we need repetitive action, then we make use of loops. Loops in C: In C programming language the repetitive operation is done […]
February 24, 2022 | C | No comments
We had already seen that both if-else and switch in C can be used for decision-making in a program. Let us discuss their similarity and differences. Similarity: In C language, if-else, as well as the switch statement, are the decision-making statements, where an expression gets evaluated on the basis of a condition, i.e., true or […]
February 23, 2022 | C | No comments
The switch statement in C provide us with an alternate way to implement the if-else if ladder in a much more simplified manner because the syntax of the switch statement is much easier to read and write. The syntax for switch statement: here, case value1, case value2…. are the various cases that a user might select. The […]
February 22, 2022 | C | No comments
As we have already seen that the if statement by itself will execute a single statement, or a group of statements when the expression following if evaluates to true, though it does nothing when the expression evaluates to false. Hence, for this distinct case, we need the else statement, which evaluates an expression when the […]
February 19, 2022 | C | No comments
Decision-making in C, as the name suggests, is a way of performing different sets of actions depending on various circumstances. Shown below is the general form of a regular decision-making structure found in most of the programming languages − Here, a particular condition statement is tested by the program, which returns true/false accordingly and executes […]
February 18, 2022 | C | No comments
The escape sequence in C represents nongraphic characters (nongraphic characters are those characters that cannot be typed directly from the keyboard, for instance, backspace, tabs, carriage return, etc). An escape sequence is represented by a backslash(\) followed by one or more characters. Escape sequences are beneficial to programmers who want to format the output. List of […]
February 16, 2022 | C | No comments
Format Specifiers in C are used during input and output operations. They specify what kind of data is getting printed or accepted during program execution, that is to say, using this concept compiler can understand what type of data is in a variable during taking input using the scanf() function and printing using printf() function. […]
February 15, 2022 | C | No comments
Comments in C are an explanation or description of the source code of the program. It helps a developer explain the logic of the code and improves program readability. These comments are not executed by the compiler rather ignored by it. Type of comments: There are two types of comments in the C language. Single-Line Comments […]
February 13, 2022 | C | No comments