Functions are called by their names. If the function does not have any arguments, then to call a function you can directly use its name. But for functions with arguments, we can call a function in two different ways, and these two ways are: Call by Value Call by Reference Call by Value Calling a …
Category Archives: Uncategorized
Type of User-defined Functions in C
In this tutorial, we will learn about the different types of user defined functions in C and the concept of Nesting of functions which is used in recursion. There can be 4 different types of user-defined functions, they are: Function with no arguments and no return value Function with no arguments and a return value …
Functions in C
A function is a block of code that performs a particular task. There are many situations where we might need to write same line of code for more than once in a program. This may lead to unnecessary repetition of code. So, C language provides an approach in which you can declare and define a group of …
Storage classes in C
In C language, each variable has a storage class which decides the following things: scope i.e where the value of the variable would be available inside a program. default initial value i.e if we do not explicitly initialize that variable, what will be its default initial value. lifetime of that variable i.e for how long will that variable …
String and Character Array
String is a sequence of characters that is treated as a single data item and terminated by null character ‘\0’. Remember that C language does not support strings as a data type. A string is actually one-dimensional array of characters in C language. These are often used to create meaningful and readable programs. For example: The string “hello world” …
Points related to 2D array
Things that you must consider while initializing a 2D array We already know, when we initialize a normal array (or you can say one dimensional array) during declaration, we need not to specify the size of it. However that’s not the case with 2D array, you must always specify the second dimension even if you …
Two dimensional (2D) arrays
An array of arrays is known as 2D array. The two dimensional (2D) array in C programming is also known as matrix. A matrix can be represented as a table of rows and columns. The below program demonstrates how to store the elements entered by user in a 2D array and how to display the elements of …
Arrays in C
An array is a group (or collection) of same data types. For example an int array holds the elements of int types. Why to use arrays? Consider a scenario where we need to find out the average of 30 integer numbers entered by user. In C, we have two ways to do this: 1) Define …
Goto statement in C
Now we will see how goto statement is used? As the name indicates, goto statement is used to jump from one place of code to another. It is like linking a code to another. When the compiler sees the goto statement, then the corresponding ‘Label’ code will executed next. Syntax of goto statement in C …
C – switch case statement
What is a Switch Statement? A switch statement tests the value of a variable and compares it with multiple cases. Once the case match is found, a block of statements associated with that particular case is executed. Each case in a block of a switch has a different name/number which is referred to as an …