There are two ways to pass the data into the function in C language: method :call by value method :call by reference. Call by value in C In this method, we pass the values of variables (the value of the actual parameters) into the formal parameters. Here, the formal parameter cannot modify the value of […]
March 9, 2022 | C | No comments
The functions that we use need to be flexible, i.e, they should be able to pass values among other functions. The mechanism used to convey information to the function is the ‘argument‘. For instance, we have used the scanf() and printf() function, in which we had been passing arguments like the format string and the […]
March 8, 2022 | C | No comments
A computer program cannot handle all the tasks by itself, instead, it requests other programs like entities called, functions in C, to get its task done. A function is a self-contained block of statements that perform a coherent task of some kind. Every C program can be thought of as a collection of these functions. […]
March 6, 2022 | C | No comments
In some programming cases, we want to take control to the start of the loop, skipping the statements inside the loop, and sometimes we want to jump out of the loop. For these purposes, we have some special statements known as the jump statement in C. They are : break statement continue statement goto statement […]
March 4, 2022 | C | No comments
Here are a few examples of the do-while loop. Printing table of a number using do-while: output: using the do-while loop, the value of ‘i’ is multiplied by 6. The loop continues till the value of ‘i’ is less than or equal to 10. Finally, the table of the given number is printed. Calculating factorial […]
March 3, 2022 | C | No comments
The do-while loop in c in an exit controlled loop unlike the for and the while loop the condition is checked at the end of the loop(i.e, after the execution of all the statements inside the do-while block), therefore the do-while loop runs at least once in the program even if the condition fails. syntax: […]
March 1, 2022 | C | No comments
Let us look at various examples of the while loop in c. Printing n numbers: output: Here, we printed n natural numbers by running a while loop till the temp reaches the nth value. counting digits in a number: output: Here, the number gets divided by 10 repeatedly until the condition becomes false; the count […]
March 1, 2022 | C | No comments
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