coderz.py

Keep Coding Keep Cheering!

Arrays in C

Arrays in the C language are a set of homogenous data types stored at the contiguous memory location. We can define one array variable to describe individual variables rather than specifying separate variables. An index lets you access a distinct element in an array. Structure of an array: Key points: Each element of an array has the same data type and size, such as int = 4 bytes. The array’s elements are kept in contiguous memory regions, with the first element kept in the smallest memory place. Because we can determine the address of each element of the array with the given base address and the size of the data element, we can access elements of the array at random. Array Declaration: We can declare an array in the c language in the following way: The array size must be a positive integer constant, and the type […]

March 14, 2022 | C | No comments

Program to check whether a number is even or odd

To determine whether an integer number is even or odd, utilize functions. We have created a function even_odd(int n) with the return type is int and has parameter n. The parameter n is tested to see if it is divisible by two. If the condition is true, then n will be an even number; otherwise, […]

March 13, 2022 | C | No comments

Recursive function in C

In the C programming language, a function may call itself. A function is called recursive if a statement within the body of the function calls the same function. Sometimes called ‘circular definition’- therefore, recursion is the process of defining something in terms of itself. Recursion cannot be applied to all the problems, but it is […]

March 11, 2022 | C | No comments

Call by Value & Call by Reference

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

Passing arguments between functions in C

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

Functions in C

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

Jump statements in C

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

do-while loop examples

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

do-while loop in c

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

while loop examples in c

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

Advertisement